ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
latemus has joined #crystal-lang
greengriminal has quit [Quit: Leaving]
<wmoxam> Having a hell of a time getting things to compile on OBSD 6.2 😅
<wmoxam> _main.o: In function `__crystal_personality':
<wmoxam> main_module:(.text+0x2868): undefined reference to `_Unwind_GetRegionStart'
<wmoxam> :/
vivus has quit [Quit: Leaving]
csk157_1 has joined #crystal-lang
csk157_1 has quit [Ping timeout: 240 seconds]
<FromGitter> <faustinoaq> You know that the language is getting popular when exist many projects frameworks 😄
<FromGitter> <faustinoaq> Well, 45 is a good start 😅
<FromGitter> <marksiemers> npm works on volume - everything is "unopinionated" and "pluggable". It's the quintessential place for "Yet another **_"
immaletyoufinish has joined #crystal-lang
<immaletyoufinish> hello
<immaletyoufinish> does anyone know what are the goals for the Lucky web framework? Does it aim to be a fully fledged framework like Rails/Amber or something smaller?
<wmoxam> `The goal: catch bugs early, forget about most performance issues, and spend more time on code instead of debugging and writing tests.`
<immaletyoufinish> wmoxam: I feel like those are already Crystal's goals in some capacity
<immaletyoufinish> I just was wondering if this is going to be a lightweight framework or compete with Amber
<Papierkorb> looked more heavy- than lightweight to me
<Papierkorb> > I love crystal yet it puzzles me how the heroic developers can make rapid progress when each compilation of the compiler takes half a minute.
<Papierkorb> OP should really retire their museum-grade computer
<Papierkorb> https://crystal-lang.org/2017/10/27/diploid-and-crystal.html#comment-3589216748 comment spam in the blog, cc RX14 no idea who to notify
<Papierkorb> Bonus points that I would have to register with disqus to report a comment
alex`` has joined #crystal-lang
immaletyoufinish has quit [Quit: Page closed]
<FromGitter> <faustinoaq> Papierkorb, I already reported the spam account on disqus
<FromGitter> <faustinoaq> > I love crystal yet it puzzles me how the heroic developers can make rapid progress when each compilation of the compiler takes half a minute. ⏎ ⏎ Papierkorb, using `amber watch` just the first compilation takes around 20s in my old Intel Celeron, the next compilations (reload on changes using sentry) take just 5s or less.
<FromGitter> <faustinoaq> Now imagine on faster computers like latest i5 i7 with enough memory. and proper configuration 😄
csk157_1 has joined #crystal-lang
csk157_1 has quit [Ping timeout: 260 seconds]
dviola has quit [Quit: WeeChat 1.9.1]
_whitelogger has joined #crystal-lang
<crystal-gh> [crystal] javanut13 opened pull request #5206: Add macro methods to ProcNotation and ProcLiteral (master...macro-methods-for-procs) https://git.io/vFIbv
csk157_1 has joined #crystal-lang
csk157_1 has quit [Ping timeout: 248 seconds]
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
csk157_1 has joined #crystal-lang
csk157_1 has quit [Ping timeout: 252 seconds]
DTZUZO has joined #crystal-lang
csk157_1 has joined #crystal-lang
csk157_1 has quit [Ping timeout: 255 seconds]
<FromGitter> <unreadable> Morning all
tdc has joined #crystal-lang
DTZUZO has quit [Ping timeout: 248 seconds]
<watzon> So there's not a Time string converter for the JSON module is there? Something that would take "2015-05-05T23:40:27Z" and parse it into a Time object?
<Yxhuvud> JSON has no concep of timestamps.
<Yxhuvud> but you may want to look into JSON#mapping
<RX14> Papierkorb, i don't have access to that
RickHull has quit [Ping timeout: 260 seconds]
<RX14> and Papierkorb, it really does take a good 30s
csk157_1 has joined #crystal-lang
<RX14> huh
<RX14> rm -Rf ~/.cache/crystal made the "cached" build drop from 25s to 15s
<RX14> i think we need to shard the directories so they have few children and have some sort of automatic cleanup
csk157_1 has quit [Ping timeout: 246 seconds]
<watzon> YYxhuvud: Lol I think you misunderstand. I am using JSON.mapping already, and just wondering if a converter has been written already that takes a String and parses it into Time.
<watzon> Similar to the EpochConverter, but with strings instead of ints
<RX14> well it depends on the format of the time
<RX14> your format is ISO8601
<RX14> and yes, we have a Time::Format::ISO_8601_DATE_TIME
<RX14> which will work as a converter
<watzon> Oh it will now?
<watzon> Well that's good to hear
<RX14> well it has to_json and from_json methods
<RX14> all time formatters have
<FromGitter> <Rinkana> Morning
<oprypin> RX14, putting this cache not in /tmp is basically a crime
<FromGitter> <bew> Hello here! How can I debounce a Channel? like if I receive nothing for 0.1 second, do something, else do something else?
<oprypin> bew, i think you'd select with timeout
<FromGitter> <bew> yes that would do it! how can I do that?
<FromGitter> <bew> oh looks like a nice way to do it, thanks!
csk157_1 has joined #crystal-lang
<FromGitter> <bew> select looks weird, it changes to call being made
<FromGitter> <bararchy> yeha, put it in /tmp will be awsome
<FromGitter> <bew> instead of `Timeout.after` (which I wrote) it calls `Timeout.after_select_action`
csk157_1 has quit [Ping timeout: 240 seconds]
<oprypin> bew, well yeah thats the point of select
<FromGitter> <bew> is it documented somewhere? I never read something like that (or don't remember)
<oprypin> no
<oprypin> eternally experimental
<FromGitter> <bew> x)
<oprypin> thats the best we have
<Papierkorb> bew, timeouts are dangerous. Not because how you do them (as opposed to ruby), but in that the timed out fiber keeps processing. E.g., a timed out network request will still be running in the background
<FromGitter> <bew> thanks @oprypin !
<FromGitter> <bew> Thanks for the warning Papierkorb, but it should play well for me
<oprypin> but then what options do we have for timeouts?
<Papierkorb> none and that's the issue
<Papierkorb> RX14 was working on something some months ago that let you inject an exception into another fiber which would've fixed it.
<Yxhuvud> at least not before proper thread support. After that, perhaps something could be possible?
<Papierkorb> No?
<Papierkorb> How is that supposed to help?
<Yxhuvud> well if you have something else that is running at the same time, then at least you have something else that could do *something*.
<Papierkorb> Um someone is doing something just fine even now
<Papierkorb> It's just that a running timed out request keeps actually running
<Papierkorb> Which may return eventually and still do the work that's not wanted anymore
<Papierkorb> Or keep on consuming a handle here or there, effectively leaking it
<Papierkorb> Or consume other resources
<oprypin> welp this is hard
<Papierkorb> the sockets support a read/write time out, but that doesn't fix all problems.
<Papierkorb> No idea if e.g. the http client allows you to set a timeout.
<Papierkorb> oprypin: Injecting exceptions fixes the issue nicely
<oprypin> hm yeah actually it does
<Papierkorb> they can be caught and properly handled
<oprypin> or not caught, then caught by select
<Yxhuvud> but then you get the same issues as timeouts in ruby-land, no?
<Papierkorb> No?
<Yxhuvud> isn't that how timeouts are solved there?
<Papierkorb> oprypin: You'd have to inject the Timeout exception into the timed out fiber, so only that fiber would "crash" if you decide to not handle it in there
<oprypin> i get it
<oprypin> there can be multiple timed out fibers at once tho
<Papierkorb> In theory sure, you could simply inject an exception in all of those you're waiting for
<Papierkorb> Yxhuvud: If the issue is something like http://www.mikeperham.com/2015/05/08/timeout-rubys-most-dangerous-api/ Then your code is broken
<oprypin> oh Timeout module lol... what could go wrong
<Papierkorb> Exception injection would also help for (effectively) deadlocked channel sends/receives
<oprypin> what Python does is just have every function implement its own timeout
<oprypin> though i would be surprised if the modern event loop alternatives in Python don't have timeouts implemented like we're discussing here
FromGitter has quit [Remote host closed the connection]
oprypin has quit [Quit: Bye]
FromGitter has joined #crystal-lang
oprypin has joined #crystal-lang
<FromGitter> <simaoneves> Is it feasible to do AOP in Crystal?
<FromGitter> <simaoneves> with macros
<FromGitter> <Rinkana> Hmm interesting
<FromGitter> <Rinkana> I've never heard of AOP
<Papierkorb> simanoneves, Can't tell you if it's feasible, but from what I read on AOP, you should be able to do many things of it with macros
<Papierkorb> simanoneves, if all you want is method call monitoring, you can do that with macros
<Papierkorb> I'm not sure yet if that is actually a good idea in all cases, but...
<FromGitter> <faustinoaq> > npm works on volume - everything is "unopinionated" and "pluggable". It's the quintessential place for "Yet another _" ⏎ ⏎ @marksiemers Well, we have a few already
<FromGitter> <faustinoaq> XD
<FromGitter> <faustinoaq> Even I did one
<FromGitter> <bararchy> 😆
DTZUZO has joined #crystal-lang
<crystal-gh> [crystal] MakeNowJust opened pull request #5208: Fix to parse regex starting with ';' after call (master...fix/crystal/parse-regex-starting-semicolon-after-call) https://git.io/vFLq4
<crystal-gh> [crystal] lbguilherme opened pull request #5209: Give error if using instance_sizeof on a generic type without type vars (master...instance_sizeof) https://git.io/vFLqd
csk157_1 has joined #crystal-lang
csk157_1 has quit [Ping timeout: 248 seconds]
<FromGitter> <simaoneves> I think some stuff is possible yes, but not all, i don't know, thats why i was asking :)
<FromGitter> <simaoneves> the idea would be to weave additional behaviour on the compilation step, without writing it in the class that would get the behaviour
<FromGitter> <simaoneves> i havent worked with macros yet, might think about it later :)
<Papierkorb> As I said, if you're interested in the monitoring aspect, you can do that with macros
<FromGitter> <simaoneves> yap, thanks 👍
csk157_1 has joined #crystal-lang
csk157_1 has quit [Ping timeout: 240 seconds]
snsei has joined #crystal-lang
csk157_1 has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
csk157_1 has quit [Quit: WeeChat 1.9.1]
csk157 has joined #crystal-lang
<Papierkorb> Ah great I can't support Ubuntu LTS 16.04 OOTB because there's no source package available for Qt5.5?
<Papierkorb> Not APT stuff, but directly from Qt
<Papierkorb> 5.6 onwards is no issue
<Papierkorb> Ah well, let that be the issue of those who care about using an archaic operating system
<jrwren> why the need for source tarball from Qt instead of the source deb?
<Yxhuvud> hmm, it seems the fresh variables example from https://crystal-lang.org/docs/syntax_and_semantics/macros/fresh_variables.html doesn't work anymore. Oh well, it worked with symbols, which is what I actually cared for
<Papierkorb> jrwren: Because I pre-generate bindings for various Qt versions and have no interest of me depending on various distributions.
<Papierkorb> jrwren: Thus, if someone on such OS wanted to use it, no prob, just needs to generate it themselves.
<Papierkorb> Here's hoping ubuntu isn't patching crap into their Qt packages. But then it's not Qt anymore, so..
<Papierkorb> I'll only use official sources by Qt
<Papierkorb> I can't rely on another distributor to add something of their choosing
<jrwren> if ubuntu/debian did the packaging according to their own guidlines then this is exactly what Qt released: https://launchpad.net/ubuntu/+archive/primary/+files/qtbase-opensource-src_5.5.1+dfsg.orig.tar.xz
<Yxhuvud> my favorite is when they backport stuff without proper quality assurance.
<Papierkorb> That's not hosted on qt.io/ and thus not supported by me in any way jrwren
<jrwren> ok Papierkorb.
<Papierkorb> jrwren: I'm a single guy. I can't maintain every random source package that's out there.
<jrwren> it *shouldn't* be a random source package, yet I understand your POV
<Papierkorb> if someone wants to, they should step up
<Papierkorb> Yxhuvud: Didn't ubuntu also completely thrash Gtk3?
<Papierkorb> or was it gtk3 that just didn't care about semver?
<Yxhuvud> dunno. I was speaking from experience of centos/redhat
<Yxhuvud> and their packaging of gems in particular.
<Papierkorb> Ah, someone in #qt knew the link to the source archive
snsei has quit [Read error: Connection reset by peer]
snsei has joined #crystal-lang
<FromGitter> <HCLarsen> I just noticed that while there is a gsub method for strings, there's no gsub! Is there a reason for this?
<Yxhuvud> strings are immutable.
<FromGitter> <acangiano_twitter> Strings are immutable in Crystal
<FromGitter> <HCLarsen> Ohhh. Is there a mutable subclass like in Obj-C?
<FromGitter> <acangiano_twitter> It's also worth noting that Crystal is a language that tries to prevent nil values as much as possible, unless you are explicitly asking for them. In Ruby, so many nils are caused by sneaky gsub! not finding the pattern within the string.
<FromGitter> <acangiano_twitter> What are you trying to d, Chris?
<FromGitter> <HCLarsen> Replace a character with a different character.
<FromGitter> <acangiano_twitter> Sorry, I meant the greater scope. My more direct question would be why a regular string wouldn't work for you.
<FromGitter> <HCLarsen> I don't understand what you mean by that. Who says a regular string wouldn't work for me?
<FromGitter> <HCLarsen> I already got it working, so a regular string works just fine.
<FromGitter> <acangiano_twitter> You were asking about mutable strings so I assumed you needed them for some reason. Great that you got it to work. 😊
<FromGitter> <HCLarsen> Well yeah. Being able to mutate strings is something that comes in handy quite often.
hightower3 has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <HCLarsen> In this case, the difference would have been string.gsub! instead of string = string.gsub. Not a huge deal, but it looks a fair bit cleaner.
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
hightower4 has quit [Ping timeout: 260 seconds]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <acangiano_twitter> I hear you. While on the subject of strings a couple more points, in case you haven't looked into them too much. They are heap allocated so somewhat expensive. String.build is worth checking out.
<Papierkorb> If not on the heap, where else should a run-time built string end up?
<FromGitter> <acangiano_twitter> I meant that the combo immutable strings and heap allocatoon can get expensive depending on what you are doing.
<Papierkorb> The crystal ubuntu package should depend on `libxml2`
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
qard has joined #crystal-lang
<qard> Is there some way to do `with self yield` in an `initialize`?
<qard> It doesn't seem to work for me.
<Papierkorb> Yes, just do it. Make sure that `self` is fully initialized though, so all non-nilable @ivars are set
<qard> The syntax is accepted, but it complains that I gave the initialize a block and the signature doesn't accept it.
<Papierkorb> Please gist your code
<Papierkorb> Mh that's new. Putting the `with yield` into a self.build method works as expected
snsei_ has joined #crystal-lang
snsei__ has joined #crystal-lang
snsei__ has quit [Client Quit]
snsei has quit [Ping timeout: 248 seconds]
snsei has joined #crystal-lang
snsei_ has quit [Ping timeout: 255 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<crystal-gh> [crystal] maiha opened pull request #5212: HTTP: delete `Content-Encoding` and `Content-Length` headers after decompression (master...http-consist-headers-body) https://git.io/vFLgp
<FromGitter> <r3bo0t> @crisward Do you have any update why this PR is not yet merged on crystal-mysql? ⏎ https://github.com/crystal-lang/crystal-mysql/pull/31
<FromGitter> <r3bo0t> There are many usecases where using DATE type actually helps. Also it restricts people to use crystal-mysql with existing application that handles DATE data type.
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
qard has quit [Client Quit]
qard has joined #crystal-lang
tdc has quit [Ping timeout: 260 seconds]
qard has quit [Client Quit]
csk157 has quit [Ping timeout: 248 seconds]
handicraftsman has joined #crystal-lang
tdc has joined #crystal-lang
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 252 seconds]
snsei has joined #crystal-lang
scalp42 has joined #crystal-lang
<scalp42> hi folks, when using method overloading, can you add multiple types? see https://gist.github.com/scalp42/c06281d476d2222b4715ec595c4f80cb
snsei_ has quit [Ping timeout: 248 seconds]
<FromGitter> <straight-shoota> @scalp42 you're looking for union types https://crystal-lang.org/docs/syntax_and_semantics/union_types.html
<FromGitter> <straight-shoota> In your case `y : Number | String`
<FromGitter> <straight-shoota> but the first way should generally be preferred
<FromGitter> <straight-shoota> having separate methods with different signatures
<scalp42> thanks a lot straight-shoota !!
<FromGitter> <unreadable> Didn't know there's a `number` type in crystal oO
tdc has quit [Ping timeout: 240 seconds]
csk157 has joined #crystal-lang
<Papierkorb> unreadable, it's the base type for everything that's number-y
<FromGitter> <unreadable> I don't think so, it's twice bigger than the `Float64` ..
<FromGitter> <unreadable> It doesn't seem to be mentioned in the gitbook
<Papierkorb> https://crystal-lang.org/api/0.23.1/Float64.html it's totally a Number
<FromGitter> <unreadable> https://carc.in/#/r/2zk2
<FromGitter> <unreadable> Well, it doesn't seem so
<Papierkorb> So?
<Papierkorb> Numbers are .. kinda special
<Papierkorb> BigInt is a number too
<Papierkorb> the class hierarchy doesn't lie
<FromGitter> <unreadable> Ok, I'll stick to Int/Float I guess
<FromGitter> <unreadable> Since I got used to
csk157 has quit [Ping timeout: 240 seconds]
csk157 has joined #crystal-lang
<RX14> @unreadable it's because Number is a union
csk157 has quit [Ping timeout: 240 seconds]
<RX14> so it needs more space to store the type of the union
<RX14> if you require "big" it should get even abigger
<RX14> cc Papierkorb
<Papierkorb> as expected
<FromGitter> <crisward> @r3bo0t I think I've been using my fork while waiting for this. Not sure why it wasn't merged, I did all the updates per the feedback I think. I have a habit of forking, fixing, using my fork then swapping over when it's merged. Kemal is super quick to merge stuff in, other shards can be a bit slower. Sometimes they have something conflicting going on I know nothing about, but feel free to use my fork while
<FromGitter> ... you wait.
<FromGitter> <eliasjpr> Is there any way to install shards in a global path?
alex`` has quit [Ping timeout: 255 seconds]
<Papierkorb> no
<FromGitter> <eliasjpr> Any plans for that?
<Papierkorb> who knows
<FromGitter> <faustinoaq> Maybe using post_install ? or https://github.com/nedpals/sharn, Would be easy to install CLI tools like amber, etc in future
<Papierkorb> Absolutely not via post_install
<Papierkorb> If someone messes with anything outside the project using some install hook, they need to be shamed publicly. And their project nuked from the orbit.
<Papierkorb> faustinoaq, I'm somewhat happy with having a `tool.sh` in bindgen, which you then use like `lib/bingen/tool.sh` from your project root. Works okay-ish I guess. Wouldn't help you to generate applications of course
<FromGitter> <faustinoaq> Would be interesting to create test like `crystal-ulib` binding `ulib` library, putting crystal at top and showing crystal capabilities of binding C. https://www.techempower.com/benchmarks/previews/round15/
<Papierkorb> Downside: This requires a `crystal deps` invocation in its post hook
<FromGitter> <faustinoaq> 👍 ✨ ✨ bindgen and qt.cr are great projects. I wan't able to create a Hackintoch to test it, my pc doesn't have enough memory and space.
<FromGitter> <faustinoaq> But works excellent on Manjaro Linux 😄
<Papierkorb> It should work OOTB on "any" linux distro since today, as long you have Qt5.5 (or later) installed
<FromGitter> <faustinoaq> When Windows support become reality, you would need to create a bat file or a PowerShell script, `tool.ps1` I would help with that 😉
<Papierkorb> Yeah I'll probably rename tool.sh to just tool, and then have a tool.bat, so both non-win and win users can use the same invocation line in their shell
<Papierkorb> It's a nice trick Qt uses too to enable everyone to call `./configure` on any OS
<Papierkorb> Or possibly, wait for someone to contribute a tool.bat. Batch scripts are just out of this universe, and some people think bash scripts are weird
<FromGitter> <faustinoaq> Yeah, I'm wondering How fast would be programs generated by native Crystal on Windows ?, Linux is often faster
<Papierkorb> ?
<Papierkorb> as fast as any other native program I guess?
<Papierkorb> faustinoaq, are you sure that no other software messed with your programs runtime? like anti-virus?
<FromGitter> <faustinoaq> Yeah, was a bad comment, sometimes I wish Crystal support on Windows too much XD
<Papierkorb> I'm a bit annoyed though that there seems to be no free service that lets you mess with mac os
<FromGitter> <faustinoaq> Yeah, Maybe apple should release a VM enviroment for developers of something, like Windows does 👉 https://developer.microsoft.com/en-us/windows/downloads/virtual-machines
<Papierkorb> the qt stuff should work with some changes though - Depending on how the qt installation was done. iirc, Qt supports a framework and non-framework mode?
<Papierkorb> work on mac os *
<Papierkorb> The biggest change would be temporarily commenting the `checks:` in config/find_paths.yml (as those files probably are called differently on mac). Then tell it where to find qmake and it should just generate and build
<FromGitter> <faustinoaq> Papierkorb, What change do I need to support loading of QML files: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ http://doc.qt.io/qt-5/qquickview.html ... [https://gitter.im/crystal-lang/crystal?at=59f6642d5a1758ed0f659951]
<Papierkorb> Basically? Add necessary classes and enums (config/*.yml), and add the necessary -l to the module: in qt.yml for qml
<Papierkorb> And then hope for the best
<Papierkorb> You can toy around with it, but without QVariant support that's not much fun I guess?
<Papierkorb> oh wait travis supports mac machines?
<FromGitter> <faustinoaq> Yes, it does