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
hightower4 has joined #crystal-lang
hightower3 has quit [Ping timeout: 258 seconds]
alex`` has joined #crystal-lang
alex`` has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
wontruefree has joined #crystal-lang
<FromGitter> <asterite> RX14: I compiled the compiler and from that compiled it again with `--release --emit llvm-ir` and I couldn't find non-inlined calls of Slice#unsafe_at. Maybe you are doing something different?
wontruefree has quit [Quit: The Internet needs a break and I need a cookie]
<FromGitter> <iambudi> What is send_select_action for in crystal channel ?
<FromGitter> <iambudi> The api does not have any description
<FromGitter> <asterite> experimental for select, so not documented
<FromGitter> <iambudi> What case should we use that?
<FromGitter> <asterite> select like in Go
<FromGitter> <iambudi> Since concurrency model of crystal is the same with go, so we can refere to Go documentation for this 👍🏽
<FromGitter> <iambudi> Thanks
<FromGitter> <GurgDev_twitter> Looking over the type inferencing algorithm docs, does this mean that you can't have the equivalent of a nullable without it being the union of X type and Nil?
<FromGitter> <asterite> That's the concept of a nullable thing in Crystal
<FromGitter> <GurgDev_twitter> Just confirming. I actually quite like that. Much more difficult to have a nil instance sneak in if there is explicitly no unions allowed in a method argument
lacour has quit [Quit: Leaving]
thews has quit [Ping timeout: 240 seconds]
<FromGitter> <CicholGricenchos> Hi all, how can I convert an `Array(String)` or `StaticArray(String, n)` into an `((UInt8*)*)` to use it in lib declaration?
thews has joined #crystal-lang
thews has quit [Changing host]
thews has joined #crystal-lang
snsei has joined #crystal-lang
<FromGitter> <bararchy> @CicholGricenchos `.to_unsafe` will give you a pointer, then you can do a Slice.new(pointer, size)
<FromGitter> <bararchy> or something like that, I'll take a look at the docs
_whitelogger has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
_whitelogger has joined #crystal-lang
<FromGitter> <ansarizafar> ===is for single line comments. How can we add multi line comments in code===
snsei has joined #crystal-lang
<FromGitter> <CicholGricenchos> @bararchy I found that `StaticArray["a".to_unsafe, "b".to_unsafe].to_unsafe` could give an `((UInt8*)*)`, still trying...
<FromGitter> <Rinkana> There are no multi-line comments. You need to use `#` for each line
<FromGitter> <Rinkana> Morning :)
<jokke> hey
<jokke> is it possible to somehow set a magic shebang in a crystal script which will call crystal on the file with "--" so that options passed to it aren't parsed by the compiler?
avdi has quit [Ping timeout: 255 seconds]
t-richards has quit [Ping timeout: 255 seconds]
Majost has quit [Ping timeout: 255 seconds]
mroth has quit [Ping timeout: 255 seconds]
aarongodin has quit [Ping timeout: 255 seconds]
manveru has quit [Ping timeout: 246 seconds]
danzilio has quit [Ping timeout: 264 seconds]
t-richards has joined #crystal-lang
mroth has joined #crystal-lang
danzilio has joined #crystal-lang
tatey has quit [Ping timeout: 260 seconds]
Majost has joined #crystal-lang
tliff has quit [Ping timeout: 269 seconds]
aarongodin has joined #crystal-lang
jhass has quit [Ping timeout: 260 seconds]
yopp has quit [Ping timeout: 240 seconds]
jhass has joined #crystal-lang
tatey has joined #crystal-lang
yopp has joined #crystal-lang
<jokke> this should explain my usecase: https://p.jreinert.com/IRE/
tliff has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <bararchy> @ansarizafar usually my IDE just handle that
<FromGitter> <bararchy> jokke so you want to run crystal as a script, that will tell bash to call the compiler to run itself ?
<FromGitter> <bararchy> why not just .. compile ?
<FromGitter> <bararchy> or use crystal run script.cr
<jokke> well mainly for easy editing of simple scripts
<FromGitter> <bararchy> I guess if that's your goal you should use Ruby, python , etc..
<jokke> yeah sure but i see no reason why i shouldn't be able to do this in crystal
<jokke> #!/usr/bin/env crystal works
<jokke> but it passes options to the compiler
<jokke> that's the only problem
snsei has quit [Remote host closed the connection]
<jokke> so that i have to pass args differently depending on how i call my script
<FromGitter> <bararchy> because it's a hack, it wasn't ment to run this way
snsei has joined #crystal-lang
<jokke> :P
<FromGitter> <bararchy> XD
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <bararchy> I also guess it's much slower then just Ruby, because the compiler needs to compile the script each time its called
<jokke> of course
<jokke> but if it's something long running that wouldn't matter much
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]
snsei has joined #crystal-lang
<FromGitter> <bararchy> I really think it's a wierd usecase haha, I would strongly suggest just compiling the script, and you can create a Makefile that takes the source from dir X, and compile it to .. lets say /usr/bin/script so that it will be easy to change and "install" the new version
snsei has quit [Remote host closed the connection]
Groogy has quit [Disconnected by services]
Groogy_ is now known as Groogy
<Groogy> Morning! o/
Groogy2 has joined #crystal-lang
<Groogy> jokke wouldn't it be better to just do like, makefiles or something?
<Groogy> script files specifically made to build stuff
flaviodesousa has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 255 seconds]
rohitpaulk has joined #crystal-lang
<RX14> @asterite I was looking at data from callgrind. I'll see if i can produce the same result or not.
mark_66 has joined #crystal-lang
alex`` has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tilpner has quit [Quit: :wq]
tilpner has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
baweaver is now known as baweaver_away
tilpner has quit [Ping timeout: 258 seconds]
rohitpaulk has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <DRVTiny> Hello, dear colleagues aka All :) ⏎ Does Crystal support inspired by JSON compact and extremally fast binary format for datastructures transfer - CBOR?
<FromGitter> <bararchy> @DRVTiny Didn't find it in a quick search, you can always use Message pack or Cannon (https://github.com/Papierkorb/cannon) , or, you can create a new shard for this RFC :)
<FromGitter> <DRVTiny> I'm trying to promote CBOR native support in Crystal, because it is ideal for NoSQL storing IMHO :)
<RX14> nosql? all the more reason not to promote it in my opinion
fiete has quit [Quit: WeeChat 1.9.1]
fiete has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
tilpner has joined #crystal-lang
<FromGitter> <yxhuvud> @drvtiny: if you want it, implement it. (preferably in a shard. Getting it merged to stdlib at this point doesn't seem likely).
gcds has joined #crystal-lang
<RX14> JSON and YAML have far far more adoption than other formats which is why it's inside the stdlib
<vegai> arithmetic is sometimes interesting
<vegai> 123/x where x > 123 => 0
<vegai> -123/x where x > 123 => -1
<vegai> I wonder how that works :P
tilpner has quit [Read error: Connection reset by peer]
tilpner has joined #crystal-lang
tilpner has quit [Read error: Connection reset by peer]
tilpner has joined #crystal-lang
<FromGitter> <bew> vegai use `123.0` for better results!
rohitpaulk has quit [Ping timeout: 248 seconds]
<Groogy> isn't that just because it is integers and it truncates the result vegai?
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has joined #crystal-lang
gcds has quit [Quit: Textual IRC Client: www.textualapp.com]
<Groogy> i.e if you have 123/246 the result if floating point be 0.5, but since it is an integer it just truncates it to 0
<FromGitter> <petoem> if the dividend is a Int and the divisor is Int too, the result is Int ⏎ because of this method https://crystal-lang.org/api/0.23.1/Int.html#%2F%28other%3AInt%29-instance-method ⏎ but if dividend (self) is Int and divisor is Float, its result is a Float => https://crystal-lang.org/api/0.23.1/Int32.html#%2F%28other%3AFloat64%29%3AFloat64-instance-method
<livcd> ttps://www.youtube.com/watch?v=mxlJqrVSalY <- i think applies to Crystal as well :)
rohitpaulk has quit [Ping timeout: 260 seconds]
claudiuinberlin has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<Yxhuvud> well, perhaps after we have won.
<Yxhuvud> (also the point he tries to make about rails is silly. Rails is sooo much better now than back in 2008).
Ven has joined #crystal-lang
Ven is now known as Guest23284
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ShalokShalom_ has joined #crystal-lang
ShalokShalom has quit [Ping timeout: 240 seconds]
<Yxhuvud> nice of him to mention Crystal though.
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
Guest23284 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has quit [Ping timeout: 264 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest98574
<FromGitter> <asterite> When does he mention Crystal?
<Yxhuvud> a bit in when he talks about go being the only modern languages that doens't have built in support for semantic versioning.
<Yxhuvud> and then mention crystal and pony as examples that do have it.
Guest98574 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
sz0 has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 252 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
azah has joined #crystal-lang
andrewzah has quit [Ping timeout: 246 seconds]
RX14 has quit [Ping timeout: 260 seconds]
RX14 has joined #crystal-lang
<FromGitter> <asterite> Cool :D
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
<FromGitter> <crisward> 21:50 in, if you don't want to wade through it all.
<FromGitter> <sdogruyol> what?
<FromGitter> <crisward> Crystal being briefly mentioned at go-lang conf uk.
<FromGitter> <crisward> He's talking about the challenges of getting go into enterprise...
<FromGitter> <sdogruyol> ah okay, thanks
<FromGitter> <elorest> nice
<FromGitter> <sdogruyol> they're already aware of us
<FromGitter> <sdogruyol> :P
<FromGitter> <sdogruyol> you should be very proud @asterite :)
<FromGitter> <crisward> @sdogruyol it's all those benchmarks floating around showing how much quicker crystal 'can' be.
<FromGitter> <sdogruyol> which benchmarks?
Ven has joined #crystal-lang
<FromGitter> <crisward> google `go lang vs crystal`, there are lots
Ven is now known as Guest84089
<FromGitter> <crisward> It's what everyone want to do with a new language.
<FromGitter> <sdogruyol> yeah ofc
<FromGitter> <crisward> It's difficult to measure how easy something is to read/write programme in, so if in doubt, show off how quick it is.
rohitpaulk has quit [Ping timeout: 252 seconds]
snsei has joined #crystal-lang
<crystal-gh> [crystal] asterite opened pull request #5132: Semantic: missing restriction logic for generic instance module type (master...bug/4287-generic-module-is-a) https://git.io/vdDos
<FromGitter> <bew> @asterite in your last PR, at this line: https://github.com/crystal-lang/crystal/pull/5132/files#diff-18057fa91aba33be36ce9a37f0253b7fR840 how can you have `super` when this class doesn't inherit from anyhing?
<Yxhuvud> bew: it still inherits from object or whatever it is?
<Groogy> Reference
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] asterite opened pull request #5133: NamedTuple: Make comparison of union of named tuples work (master...bug/5131-compare-named-tuple-union) https://git.io/vdD6r
<FromGitter> <asterite> bew: it inherits from GenericInstanceType
<FromGitter> <DRVTiny> Hello2All, again! Anybody knows, does Crystal support system-wide installing of libraries. I have the same library source codes in the 5 folders at the same time. When i invoke "crystal deps" it installs all needed by my application into the "lib/", but not in some "$HOME/.crystal/lib" or "/usr/lib/crystal", etc. Is it not supported at all by shard r am i doing/expecting something totally wrong? Thank you!
<FromGitter> <asterite> No such thing exists, and that's a feature
<FromGitter> <DRVTiny> Hmm Strange feature :)
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]
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
<FromGitter> <asterite> Once you delete a project, its dependencies are removed with it. You can't end up with unused libraries in a global directory.
<Yxhuvud> It is debatable if it is a feature or not, but it is certainly intentional.
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <bararchy> Also , when keeping all shard in one lib one needs to keep a version of the shard for each project if they need a specific version , which would mostly mean you won't save.much space if any at all
claudiuinberlin has quit [Client Quit]
claudiuinberlin has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #5132: Semantic: missing restriction logic for generic instance module type (master...bug/4287-generic-module-is-a) https://git.io/vdDos
<FromGitter> <DRVTiny> @bararchy But i can update shards in one place. And if package doesnt break its ABI frequently - why do i have to save all versions of the same package? Keeping back-compatibility for the relatively long time and not breaking it without significant reasons - is a normal practice in libraries development, doesnt it?
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
ShalokShalom_ is now known as ShalokShalom
Guest84089 has quit [Ping timeout: 240 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest49263
<oprypin> DRVTiny, you can symlink the lib folder to one location if you really want
<FromGitter> <crisward> Shards also has a path option, you can use this to setup your own global folder and point everything to it.
<FromGitter> <crisward> eg ⏎ ⏎ ```dependencies: ⏎ somemod: ⏎ path: /global_deps/somemod``` [https://gitter.im/crystal-lang/crystal?at=59e4dd0df7299e8f53f471ed]
<FromGitter> <paulcsmith> That's also very helpful if you are working on a shard and want to try something out before releasing a new version on GitHub!
<FromGitter> <Rinkana> Too bad you can't use both path and github (for now).
rohitpaulk has quit [Ping timeout: 240 seconds]
Guest49263 has quit [Ping timeout: 258 seconds]
wontruefree has joined #crystal-lang
<FromGitter> <Rinkana> Arg, sometimes 3d stuff gives you the weirdest bugs: https://imgur.com/a/qcP5a
Ven has joined #crystal-lang
Ven is now known as Guest48109
<crystal-gh> [crystal] RX14 closed pull request #5109: Codegen: compile untyped typeof(exp) correctly (master...fix/crystal/5105-compile-untyped-type-of-correctly) https://git.io/vd6Xd
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
<RX14> @DRVTiny you really don't want to update all your shards in one place
<RX14> it means you need to have the same shard type for every single project
<RX14> shard version*
<RX14> and that's genuinely terrible
<RX14> well, as soon as you stop working on your own projects
<RX14> but thats most people that work on at least one project that they don't completely own
rohitpaulk has joined #crystal-lang
Guest48109 has quit [Ping timeout: 264 seconds]
<travis-ci> crystal-lang/crystal#4721e6b (master - Codegen: compile untyped typeof(exp) correctly (#5109)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/288652204
<DeBot_> https://github.com/crystal-lang/crystal/pull/5109 (Codegen: compile untyped typeof(exp) correctly)
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/vdDFs
<crystal-gh> crystal/master 91d3861 Ary Borenszweig: NamedTuple: Make comparison of union of named tuples work
<crystal-gh> crystal/master 51bf369 Ary Borenszweig: Merge pull request #5133 from asterite/bug/5131-compare-named-tuple-union...
mark_66 has quit [Remote host closed the connection]
rohitpaulk has quit [Ping timeout: 264 seconds]
<travis-ci> crystal-lang/crystal#51bf369 (master - Merge pull request #5133 from asterite/bug/5131-compare-named-tuple-union): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/288664843
<DeBot_> https://github.com/crystal-lang/crystal/pull/5133 (NamedTuple: Make comparison of union of named tuples work)
baweaver_away is now known as baweaver
<FromGitter> <paulcsmith> How are people representing columns stored as a date in the database? Do you just use `Time` and set the hours, mins, sec, etc. to 0?
claudiuinberlin has joined #crystal-lang
wontruefree has quit [Quit: The Internet needs a break and I need a cookie]
wontruefree has joined #crystal-lang
<FromGitter> <DRVTiny> @crisward Thank you! How to setup PATH for shards?
<FromGitter> <DRVTiny> And, yeah, i'm trying to repare ftp client lib, because it doesnt work on 0.23.1. Who remember, what class support methods "open" and "binmode"
<Yxhuvud> paulcsmith: Proper databases have date column types. I'd use one of those.
<FromGitter> <paulcsmith> @yxhuvud I meant what Crystal type do you use. Since there is no Date time, just Time
<FromGitter> <paulcsmith> Sorry for being unclear
wontruefree has quit [Quit: The Internet needs a break and I need a cookie]
<FromGitter> <DRVTiny> How to convert from String type to Bytes type?
<FromGitter> <DRVTiny> I need to send String to TCPSocket, but it doesn't accept string
<FromGitter> <DRVTiny> Sorry for stupid question :(
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
<FromGitter> <DRVTiny> Oh, yeah, to_slice. Its obvious!
<FromGitter> <asterite> You probably want socket << string, or socket.print string
<FromGitter> <AndreasKl> Hi Crystal users, friends and I organizing a free, community tech meetup in Bonn, Germany. We are planning a meetup about new programming languages. If someone is from the cologne area and would like to give a brief intro to Crystal in Bonn we would be super happy :-)
<FromGitter> <sdogruyol> welcome @AndreasKl , we have some users from Germany, maybe @jhass can help :P
Ven has joined #crystal-lang
Ven is now known as Guest97114
<FromGitter> <AndreasKl> @sdogruyol that would be nice, I played around with the basics but do not feel confident to talk about a language I know only a few days..
<FromGitter> <AndreasKl> As jhass is from Berlin it is most likely too far away for a 30min intro of the language
<FromGitter> <DRVTiny> Anybody knows how to get MD5 file digest in Crystal 0.23.1?
<FromGitter> <DRVTiny> ```code paste, see link``` ⏎ ⏎ Something unpredictabe: Digest::MD5 is a core api package [https://gitter.im/crystal-lang/crystal?at=59e502ad210ac26920f35f4e]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
Guest97114 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<oprypin> dont use icr lol
<oprypin> guess now i know which module needs documentation next https://crystal-lang.org/api/0.23.1/Digest/MD5.html
<oprypin> https://crystal-lang.org/api/0.23.1/File.html#open%28filename%2Cmode%3D%26quot%3Br%26quot%3B%2Cperm%3DDEFAULT_CREATE_MODE%2Cencoding%3Dnil%2Cinvalid%3Dnil%2C%26block%29-class-method https://crystal-lang.org/api/0.23.1/IO.html#read%28slice%3ABytes%29-instance-method https://crystal-lang.org/api/0.23.1/Digest/MD5.html#update%28data%29-instance-method
<oprypin> DRVTiny, use these. example coming soon
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
jsn- has joined #crystal-lang
<oprypin> DRVTiny, https://carc.in/#/r/2x0b holy crab that was quite an adventure
wontruefree has joined #crystal-lang
<FromGitter> <HCLarsen> Hey guys, when sending requests with HTTP::Client, is there a way to send parameters without putting them directly in the address?
<oprypin> HCLarsen, use a POST request if thats an option
<oprypin> post_form
wontruefree has quit [Ping timeout: 252 seconds]
<oprypin> HCLarsen, `.get(url + "?" + HTTP::Params.encode({"a" => "b"}))`
<FromGitter> <HCLarsen> Thank you. The HTTP Client documentation does not mention anything about params in the get method.
<oprypin> HCLarsen, well it's not anything special
<oprypin> mayve this would be a nice example to have there
<FromGitter> <HCLarsen> Absolutely.
<oprypin> feel free :p
Ven has joined #crystal-lang
Ven is now known as Guest35881
<Yxhuvud> The spec doesn't prohibit a body for the get case, does it?
<oprypin> Yxhuvud, i think it should be illegal for a get request. would be curious to see what happens
<FromGitter> <HCLarsen> No, it doesn't.
<Yxhuvud> seems it mandates it to be irrelevant though. weird spec.
<oprypin> HCLarsen, could you paste the link i just sent again
<FromGitter> <HCLarsen> This one?
<FromGitter> <HCLarsen> That's the post method though.
<oprypin> yeah i just wanted a link to httpclient
<oprypin> i looked through the code and i still have no idea what's being done to request body
alex`` has quit [Ping timeout: 252 seconds]
<oprypin> it's nested like 10 methods deep and probably in another file but you don't know where the other file is referenced
<oprypin> this is a big downside of Ruby's heritage, both in the lack of file boundaries and the overuse of abstractions
<Yxhuvud> It is easy to build abstractions. Finding the right ones are hard and take time and effort. Ruby (and Crystal) make it easy to build them, and that make it easy to build both wrong and right abstractions.
<FromGitter> <HCLarsen> Crystal still uses the @@ for class variables, right?
<FromGitter> <asterite> I'd lately prefer an import system like Go or Python, but I guess it's too late to change that
Guest35881 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<oprypin> at least that acknowledgment makes me feel better
<FromGitter> <HCLarsen> There's no + operator for hashes?
<Yxhuvud> There are no operators. There are methods. What do you want your + to do?
<FromGitter> <HCLarsen> Basically the same as merge! . Using + would make the code smoother than merge!.
<FromGitter> <Papierkorb> That's fine, as `#merge` has you covered
cyberarm has quit [Ping timeout: 246 seconds]
<FromGitter> <martinos> `#merge!` would be more `+=`
<FromGitter> <sdogruyol> @asterite why do you prefer that?
<FromGitter> <HCLarsen> Ok, right. It would have been just merge that I was looking to do with a +.
<FromGitter> <HCLarsen> As I said @Papierkorb , using the + would be smoother. If I didn't love readable code, I'd be a JavaScript developer.
tilpner has quit [Ping timeout: 258 seconds]
<oprypin> HCLarsen, that is going too far from commutativity
<FromGitter> <asterite> @sdogruyol is makes code easier to understand and follow. It makes writing an IDE easier too. It avoids global pollution
<Yxhuvud> oprypin: I'm not certain it would be worse than Array#+
<FromGitter> <sdogruyol> (never used Python though)
<FromGitter> <sdogruyol> @asterite are you also ok with something like Java imports?
<Yxhuvud> Java imports. *shudder*
<oprypin> HCLarsen, it is NOT intuitive because one person will say "of course entries from the first operand should take precedent" while another person will say "of course [the opposite]"
<oprypin> Yxhuvud, ^ too
<FromGitter> <HCLarsen> What's wrong with Array#+?
<oprypin> HCLarsen, Yxhuvud's point is that it's not wrong and merge is no different
<oprypin> my point is that Array#+ is very slightly wrong (no commutativity) but it's common and non-ambiguous, on the contrary to the supposed Hash#+
<FromGitter> <HCLarsen> What's commutativity?
<FromGitter> <martinos> @HCLarsen a + b = b + a
<Yxhuvud> oprypin: good point, actually.
<FromGitter> <HCLarsen> Ok.
<FromGitter> <krypton97> What would you guys choose between java and c# and why?
<FromGitter> <martinos> @HCLarsen, I am new to Crystal but personally I think that it's a very good thing that it stay close to Ruby.
<FromGitter> <krypton97> And I'm the only here comparing it with python
<FromGitter> <HCLarsen> @martinos I agree. I'm a Rubyist, and started working with Crystal because I miss being able to compile my code.
<crystal-gh> [crystal] RX14 closed pull request #5034: Force calls with blocks to have their arguments parenthesised (master...feature/block-unification) https://git.io/vdT6l
<oprypin> krypton97, C# is less verbose and has less baggage of backwards compatibility so things make more sense. but the choice is usually dependent on the platform, not purely the language
tilpner has joined #crystal-lang
<FromGitter> <yxhuvud> As c# runs on Linux these days I would argue that it is about having programmers that know both platform and language. And inertia, of course.
<FromGitter> <martinos> @HCLarsen , my preferred syntax for updating records is Elm's one `{user | name = 23, age = 34}`, short and sweet. But this is a complete new syntax.
<FromGitter> <HCLarsen> I have never seen that before. I don't think I understand it.
<FromGitter> <HCLarsen> Ok, I definitely don't get it.
<FromGitter> <martinos> @HCLarsen , in this case you update the `name` and the `age` of the user record (hash).
<FromGitter> <HCLarsen> So, name and age are keys in the hash, and user is the variable name?
<FromGitter> <krypton97> Looks neat
<FromGitter> <martinos> @HCLarsen, sorry my example was messed up
<FromGitter> <HCLarsen> I saw the fix, but I'm still unsure if I understand it correctly. Is "user" the variable name for the hash? Or is it a key for a hash that contains another hash, with the keys of name and age?
<RX14> @asterite considering how fast the crystal parser is, it's so cheap to parse *everything* that I'm not sure an import system would really help an IDE.
<FromGitter> <martinos> Yes it's the variable name of the record (hash) that you want to change.
<FromGitter> <HCLarsen> Oh, ok. Cool then.
<FromGitter> <HCLarsen> Does Crystal use this syntax?
<FromGitter> <martinos> No, I was just saying what is my preferred syntax for this. Sorry if I confused you.
<FromGitter> <HCLarsen> Not at all, it's quite interesting.
<FromGitter> <asterite> RX14: without import if you find Foo in a file you don't know where that Foo comes from, because maybe that file was required from somewhere else where Foo was also required. Basically, that file cannot work without also requiring other files too. So the require system is kind of broken
<RX14> @asterite well you have to tell your IDE the top-level file
<RX14> sure, that's a downside
<RX14> it's quite a large one because it often means it's not 0-config
<RX14> but I still don't think it'd be worth changing if we could
wontruefree has joined #crystal-lang
<RX14> perhaps i've been using crystal too long
<RX14> i guess its a pointless debate anyway
<FromGitter> <asterite> RX14: exactly, but when you have multiple spec files, multiple main files, etc. it's just inconvenient and tedious
<FromGitter> <asterite> Oh the other hand, you get to type *a lot less* with require
<RX14> well so is liting deps at the top of each file
<RX14> tradeoffs
<RX14> for a human, dependencies are typically project-level
<RX14> you think about a dependency as being a place which your project can access
<RX14> obviously an IDE wants to know from the file itself
<RX14> but i don't think a human thinks that way
<FromGitter> <asterite> Also, I'm thinking an IDE could parse the top-level, which is quite fast, to determine all types, so maybe not a problem
<RX14> I think a good IDE default is to look at the shard targets for apps
<RX14> and at the default require file for shards
<RX14> 99% of shards simply use require "shard_name"
<RX14> shard_name is from shards.yml
<RX14> so you can find the top-level file for shatds that way
<RX14> i wouldn't say it's the end of the world
wontruefree has quit [Ping timeout: 248 seconds]
<RX14> and yes, just parsing then looking at the top level should be fast
<RX14> i've actually thought about how i'd implement a language server for crystal quite a bit
<RX14> perhaps i should find out why my ideas are wrong some day
<FromGitter> <crisward> Also require allows patching, you can't really reach into other files with import ( I think )
<FromGitter> <crisward> Bearing in mind I know very little about compilers, I've been trying to wrap my head around crystals compiler limitations.
cyberarm has joined #crystal-lang
<oprypin> crisward, you're saying that as if it's a good thing
<FromGitter> <crisward> @oprypin what the patching thing? It can be if you need to fix a bug why you wait for an update...
<FromGitter> <crisward> If it's about the compiler limitations, I was wonder why the whole program is evaluated in one go, every time.
<FromGitter> <crisward> I know methods are only 'created' when the method knows how it's been called by other code...
<FromGitter> <crisward> But I can't help thinking some step could happen which store these as generated header files, which record the reason why they were created
<FromGitter> <crisward> I prefixed this with I know nothing about compilers for a reason 😉
<oprypin> crisward, you're basically talking about a one-pass compiler
<oprypin> making Crystal one-pass would not work well for the language and I think it would not be a significant performance advantage
<FromGitter> <crisward> But if the header files new they were created because file_a and file_b, then surely it would only have to recompile that code if either of those files changed?
<oprypin> see previous statement
<oprypin> crisward, I expect that this optimization would speed up compilation about 3%. pulled that number out of my ... . but the point is that rearranging the abstract syntax tree is tiny compared to code generation
<FromGitter> <crisward> But would it not get around the issue of having to hold the whole thing in memory?
<oprypin> crisward, I can say the exact same about memory usage as I just said about time.
<FromGitter> <crisward> It just strikes me that build tools like typescript are doing something similar to crystal, yet have significant speedup on a file change, compared to first compile. I am sure there are difference I'm not aware of, but can't help thinking there may also be parallels.
<oprypin> crisward, the worst part is combinatoric explosion of generated methods and the corresponding codegen. typescript doesnt even generate code in traditional sense
<FromGitter> <asterite> TypeScript doesn't compile to native code, it's dynamic
<FromGitter> <akzhan> As @funny-falcon pull request was closed, I don’t know who will create hast hashes for Crystal.
<FromGitter> <akzhan> I habe number normalization in plans until new year. and it’s all
<FromGitter> <akzhan> StringPool shows the difference - up to 40 % performance… hrrrr
<FromGitter> <akzhan> and yes, SIPHash is greatest BRAKE ever. but it’s imho.
<FromGitter> <aarongodin> I was using Process.run today and thought the method signature was a little… verbose. Is it a practice to take an options hash in crystal to provide defaults on as in Ruby? Seems like Process.run would benefit from that
<oprypin> aarongodin, how exactly would it benefit from that?
<oprypin> Hash of arbitrary types does not work for Crystal because every value could be of every type
<oprypin> I mean you could do a NamedTuple of options but what's the point if you can just do that anyway?
<FromGitter> <aarongodin> Ah, good point. I hadn’t thought of the NamedTuple—you mean to say I should use that to apply arguments to the method call?
<oprypin> aarongodin, `args = {command: "a", args: [b], chdir: "c"}; Process.run(**args)`
<FromGitter> <aarongodin> The benefit being I could specify the last arg without having to specify the rest of them. I see your point about types though
<oprypin> aarongodin, or, you know, just `Process.run(command: "a", args: [b], chdir: "c")`
<FromGitter> <aarongodin> @oprypin dope, I didn’t realize you could specify args like that
<oprypin> if you want to get the good stuff, and not just wonder why this or that thing from ruby is missing, you need to read the docs first.
<FromGitter> <aarongodin> gorgeous :)
<FromGitter> <aarongodin> that’s fair. I don’t expect it to be exact parity or anything like that
<FromGitter> <martinos> Any of you knows if it exists a timezone library ?
<FromGitter> <asterite> It should be in the standard library. Maybe one day... (but it's too hard and time-consuming to implement)
<FromGitter> <martinos> Thanks, I understand it's not a simple task.
cyberarm has quit [Ping timeout: 255 seconds]
cyberarm has joined #crystal-lang
<FromGitter> <straight-shoota> implementing the actual timezone handling isn't even that complicated, really. there are quite a few good implementations which can lead the way. The tricky part is deciding on how timezone data is stored and updated.