RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.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
faustinoaq has quit [Read error: Connection reset by peer]
<FromGitter> <lbarasti> Hi folks. I'm struggling with some macro + underscore business. ⏎ Is it legal to define a macro that returns a tuple containing `_`? ⏎ This would be for pattern matching purposes. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a4c1d69b48e8c3566926c68]
<RX14> nope
<RX14> i don't think it is
<RX14> well you can try it but I doubt it
<FromGitter> <lbarasti> Thanks, yes, that matches my experience. Do you know of any workaround to produce `_` in that context?
<RX14> you need to macro the whole case statement
<FromGitter> <lbarasti> like an `extended_case` kind of thing you mean
<RX14> not really
<RX14> you just need a macro that expands to the case statement with the {_, 5} already in it
<FromGitter> <straight-shoota> I think that's what he was getting at
<FromGitter> <lbarasti> yep, I think I get what you mean. Sounds good, I'll give that a try, thanks :)
<FromGitter> <lbarasti> mhmh, thinking about it, I'm afraid even producing an underscore programmatically might totally kill the fun. I'd need to define my macro to accept a `{_, 5}` like expression. Not sure the AST will be happy with that
<RX14> @lbarasti what exactly is this macro for?
<FromGitter> <lbarasti> Actually, it works fine, my bad. Here is a working example ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a4c207368d092bb6218850b]
<oprypin> lbarasti, you can use https://carc.in to share runnable examples. that's nicer for IRC folks, as well
<FromGitter> <lbarasti> @FromIRC RX14 I'd like to get to a point where one can write something along the lines of ⏎ ⏎ ```person = Person.new("John", 18) ⏎ case person ⏎ when Person(_, 18) then "success" ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5a4c2154edd223081106216a]
<oprypin> that's just hopeless
<FromGitter> <lbarasti> Thanks orpypin, here is the previous working example in carc.in: https://carc.in/#/r/3bw2
<FromGitter> <lbarasti> > **<oprypin>** that's just hopeless ⏎ Yes, it is with that syntax 😄 ⏎ I'll try with something different - nowhere near as clear
<oprypin> lbarasti, i think it's a good idea to drop `case` at some point and rely on a chain of conditions if you're gonna fully replace it a anyway
<oprypin> that way it might be easier to stack
<oprypin> also consider using `return` in those because a macro can't start with elsif
rohitpaulk has quit [Ping timeout: 240 seconds]
<oprypin> (macros need to be full valid expressions)
<oprypin> that's all from me
<RX14> @lbarasti if you consider what's an AST node in crystal - a macro has to return what can be parsed intoa full AST node
<RX14> actually, an easier way to think: if you placed just what the macro returned into an empty file, it has to be valid crystal (it can be nonsensical though)
<FromGitter> <lbarasti> > **<RX14>** actually, an easier way to think: if you placed just what the macro returned into an empty file, it has to be valid crystal (it can be nonsensical though) ⏎ ⏎ That helps, I guess in my case it means `_` can only appear next to a `when` clause
<RX14> yes
<FromGitter> <lbarasti> > **<oprypin>** @lbarasti, i think it's a good idea to drop `case` at some point and rely on a chain of conditions if you're gonna fully replace it a anyway ⏎ ⏎ That's a good point, I might have to give up the idea of exploiting `_` though, if I understand the way it gets desugared
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <lbarasti> Thanks a lot to both, hope I can get something out of these suggestions! Cheers
cremes has joined #crystal-lang
<FromGitter> <straight-shoota> @RX14 an idea on that? ⏎ ⏎ > Now the linker gives this error: ⏎ `gc.lib(misc.obj) : error LNK2019: unresolved external symbol __imp_MessageBoxA referenced in function GC_win32_MessageBoxA ⏎ spec_test.exe : fatal error LNK1120: 1 unresolved externals` [https://gitter.im/crystal-lang/crystal?at=5a4c29ed0163b02810a6205f]
<RX14> Yes
<RX14> There's an extra flag you need
<RX14> To the libgc build
<RX14> But you might be able to get away with adding user32.lib to the link command
<RX14> Or maybe it was kernel32.lib
<RX14> I'm on my phone I'll work it out tomorrow
<RX14> Its 1am lol
greengriminal has joined #crystal-lang
alexherbo2 has quit [Quit: WeeChat 1.9]
sz0 has quit [Quit: Connection closed for inactivity]
alex``` has joined #crystal-lang
illyohs has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
alex``` has quit [Quit: WeeChat 1.9]
vivus has quit [Quit: Leaving]
<crystal-gh> [crystal] MakeNowJust opened pull request #5513: Add ASTNode#single_expression and refactor with using it (master...fix/crystal/ast-single-expression) https://git.io/vbjeI
cremes has quit [Quit: cremes]
DTZUZU has joined #crystal-lang
illyohs has quit [Ping timeout: 272 seconds]
greengriminal has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <codenoid> helo. i have crystalphobic friend
<FromGitter> <braidn> how phobic?
jnyw has quit [Max SendQ exceeded]
jnyw has joined #crystal-lang
<vegai> interesting attitudes in the scala team leadership, presumably
<vegai> thanks to the leaders of this language for being sane
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
dragonkh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yopp has joined #crystal-lang
<FromGitter> <sdogruyol> morning everyone
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
<FromGitter> <imonmyown> @sdogruyol morning :)
<FromGitter> <bararchy> Morning :)
rohitpaulk has joined #crystal-lang
flaviodesousa has joined #crystal-lang
alexherbo2 has quit [Quit: WeeChat 1.9]
mark_66 has joined #crystal-lang
mark_66 has left #crystal-lang ["PING 1514967731"]
claudiuinberlin has joined #crystal-lang
Liothen has quit [Remote host closed the connection]
<FromGitter> <codenoid> idk @braidn , he always mocking unprooven technology
Liothen has joined #crystal-lang
<FromGitter> <bararchy> "unprooven" ?
<FromGitter> <bararchy> specs works :)
<FromGitter> <bararchy> and it compiles and runs
<FromGitter> <bararchy> and it's used in production...
<lvmbdv> i bet he loves java :^)
<FromGitter> <vpereira> hi Crystal addicted :)
<FromGitter> <vpereira> I implemented the chop Kata in Crystal and I would like to know how could I improve my "crystal dialect" https://github.com/vpereira/karate/blob/master/src/karate.cr
<lvmbdv> oh god please call it binary search
<FromGitter> <vpereira> lvmbdv: from Wikipedia: "In computer science, binary search, also known as half-interval search,[1] logarithmic search,[2] or binary chop,[3]" :P
<FromGitter> <vpereira> but chop because http://codekata.com/kata/kata02-karate-chop/
<lvmbdv> when i hear "chop kata" i think "karate"
<lvmbdv> when i hear "binary search" i think "computers"
<FromGitter> <vpereira> me too, thats why the class name is Karate :^)
<FromGitter> <vpereira> those uiaaaaaaaaaaa uhhhhhhhhhhhhhh and the crystal minions chopping an array like crazy
<FromGitter> <codenoid> hahaha, yes @lvmbdv
ua has quit [Excess Flood]
<lvmbdv> then their opinion can be automatically discarded codenoid
<FromGitter> <marin117> can anybody help me with writing from_json method for time::span?
<FromGitter> <marin117> I have json mappings with span types
<FromGitter> <marin117> and either I get undefined method 'to_i64' for JSON::PullParser error
<FromGitter> <marin117> or it won't convert all data from json
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
ua has joined #crystal-lang
ua has quit [Remote host closed the connection]
ua has joined #crystal-lang
bew has joined #crystal-lang
<crystal-gh> [crystal] Wulfklaue opened pull request #5515: Returns the effective, real group and user ID of the current process (master...master) https://git.io/vbjBK
alex`` has joined #crystal-lang
jnyw has quit [Quit: WeeChat 2.0.1]
<FromGitter> <straight-shoota> @RX14 With user32.lib it works 👍
<RX14> Nice
<RX14> There's a cmake option to compile pcre so it doesn't depend on user32
<RX14> That's what I think is the real solution.
Liothen has quit [Quit: The Dogmatic Law of Shadowsong]
Liothen has joined #crystal-lang
Liothen has joined #crystal-lang
<FromGitter> <straight-shoota> yeah
hightower2 has joined #crystal-lang
hightower3 has quit [Ping timeout: 264 seconds]
bew has quit [Ping timeout: 248 seconds]
<FromGitter> <straight-shoota> do you have any idea on that option? I couldn't find anything
<FromGitter> <straight-shoota> I got time_spec to run
<RX14> @straight-shoota I can't remember, I think it's actually just a cflag
<RX14> Oh yeah no
<RX14> Its for libgc
<RX14> Not pcre
<RX14> So you need to edit the win32.mak file to add a -D preprocessor flag
<RX14> Its really ugly lol
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <straight-shoota> yeah, I'll stick to adding user32.lib :P
<FromGitter> <straight-shoota> This is really weird: ⏎ ⏎ ```Time.parse("000000321", "%N").nanosecond.should eq(321)``` ⏎ ⏎ => Expected: 321 ... [https://gitter.im/crystal-lang/crystal?at=5a4ccc5e5355812e57481000]
<RX14> Probably the Codegen bug
<RX14> Well
<RX14> I suspect there's a Codegen bug on windows
<RX14> And so basically everything's broken
<FromGitter> <straight-shoota> yeay
<RX14> For example what you posted doesn't even touch libc
<RX14> And its broken
<FromGitter> <straight-shoota> yes it's just very basic arithmetic operations
<RX14> Yeah
<RX14> It'd be great to get a small reproducing snippet
<FromGitter> <straight-shoota> I'll try to boil it down
<RX14> Try just printing the time.parse.nanosexond but in an empty file
<RX14> And see if you get the wrong answer
<crystal-gh> [crystal] RX14 closed pull request #5422: Implement Crystal::System::Time for win32 (master...jm-windows-time) https://git.io/vbyTC
rohitpaulk has joined #crystal-lang
<FromGitter> <asterite> Hi! What's the best way to try the Windows stuff on mac? Any recommended virtual machine and image?
<FromGitter> <asterite> I might try to find that codegen bug, if there's any
<FromGitter> <straight-shoota> It seems it just comes down to `10 ** 0 == 10`
<Vexatos> I mean, there are easy to use virtual machines and low-impact virtual machines
<RX14> not a clue on mac @asterite
<RX14> on linux I would have told you to use KVM via virt-manager
<Vexatos> I think you can get qemu on brew?
<RX14> qemu != kvm Vexatos
<Vexatos> yes but qemu _and_ kvm
<FromGitter> <bararchy> @asterite Microsoft gives free VM's for testing
<RX14> kvm is part of the linux kernel Vexatos
<RX14> how are you going to ket it on mac
<RX14> ???
<Vexatos> by mac having something similar maybe
<Vexatos> I mean, worst case you can just get virtualbox
<FromGitter> <sdogruyol> yeah
<FromGitter> <sdogruyol> I'd recommend VMWare fusion thought it's not free
<FromGitter> <bararchy> they got image for parrallel
<FromGitter> <bararchy> it's mac
<FromGitter> <sdogruyol> cool
<RX14> @asterite maybe investigate https://github.com/mist64/xhyve
<FromGitter> <asterite> thanks everyone!
<RX14> virtualbox is slow
<Vexatos> I know very little about mac
<Vexatos> yes it is
<RX14> Vexatos, then keep quiet
<Vexatos> but it is easy as heck to use and works
<Vexatos> so for "just getting something tested", virtualbox might be the way to go
<RX14> xhyve isn't proprietary so i'd definitely use that first
<RX14> oh actually seems xhyve doesn't support windows....
<RX14> guess osx hypervisors suck
<RX14> use linux
<RX14> @straight-shoota wait, that's it?
<crystal-gh> [crystal] bew opened pull request #5516: Remove old legacy checks in callstack specs (master...fix-callstack-spec-for-last-crystals) https://git.io/vbjwQ
<RX14> huh but that's implemented in crystal @straight-shoota
<RX14> i'll investigate it myself
<FromGitter> <straight-shoota> it seems so
cremes has joined #crystal-lang
<travis-ci> crystal-lang/crystal#5c60ae2 (master - Implement Crystal::System::Time for win32 (#5422)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/324562481
<DeBot> https://github.com/crystal-lang/crystal/pull/5422 (Implement Crystal::System::Time for win32)
<RX14> well unless @asterite is investigating it anyway
<FromGitter> <asterite> Nah, still installing stuff. I might try it on a real computer, but maybe it'll be boring to transfer files between that and the mac
<FromGitter> <asterite> but I have no idea where to uncompress those zip files (the binary builds)
<RX14> @asterite all you need is the pcre.lib and the gc.lib files in a directory
<RX14> then you just copy the object file over
<RX14> and execute the cl command
<FromGitter> <asterite> Ah, cool :)
<RX14> when you're in the same directory as the lib files
<RX14> i mean
<RX14> I ended up using scp to copy the files
<RX14> just a quick scp && cl && ./test.exe
<RX14> it's rather a quick cycle actually
<RX14> given that we don't even have most of the corelib, it compiles windows executables in milliseconds
<RX14> @asterite the pcre.lib built by @bcardiff doesn't work though :(
<RX14> you need to follow the instructions on the wiki page to actually build pcre for that
<RX14> @asterite actually, let me just upload my .lib files...
<RX14> @asterite ^
rohitpaulk has quit [Ping timeout: 265 seconds]
<crystal-gh> [crystal] RX14 pushed 5 new commits to master: https://git.io/vbjKQ
<crystal-gh> crystal/master 2739f90 Will Richardson: Add macro methods to ProcNotation and ProcLiteral...
<crystal-gh> crystal/master 792deb2 Will Richardson: Add tests for proc notation and literal
<crystal-gh> crystal/master 9b1a9e7 Will Richardson: ProcLiteral includes args and body macro methods
<RX14> uhh
<RX14> oops
<RX14> darn, when did github reset by default merge strategy to *not* be squash onto master
<jokke> hehe
<FromGitter> <asterite> what's libcmt.lib? I don't have it
<RX14> @asterite it's libc, multithreaded
<vegai> RX14: hasn't it always been that?
<FromGitter> <asterite> i should have it already? I get a lot of linker errors
<RX14> github typically saves the marge strategy locally
<RX14> @asterite yes you should
<RX14> are you using the x84 msvc prompt?
<FromGitter> <asterite> __imp_VirtualAlloc
<FromGitter> <asterite> I guess
<RX14> x64*
<RX14> x64 native tools command prompt
<RX14> ?
<FromGitter> <asterite> x86_64 cross tools command prompt
<FromGitter> <asterite> or "Developer command prompt for vs 2017"
<FromGitter> <asterite> I have those two
<RX14> well
<RX14> wait what
<RX14> you don't want cross tools
<FromGitter> <asterite> but I don't have any libcmt.lib in that directory
<RX14> libcmt.lib is part of the distribution
<RX14> and when you open the msvc prompt it sets the linker path
<RX14> which should include the directory libcmt.lib is in
<FromGitter> <asterite> then I don't know how to access that prompt
<RX14> @asterite what did you install?
<FromGitter> <asterite> oh, I think I found it
<RX14> hmm?
<FromGitter> <asterite> i'm using my wife's computer and it's in spanish
<FromGitter> <asterite> so the program's name is in spanish :-P
<RX14> lol
<FromGitter> <asterite> Cool! It worked :)
<RX14> yay
<FromGitter> <asterite> so what's the codegen bug? maybe you can report it in github and we can start tracking it there
<FromGitter> <asterite> I don't know if I'll have time to see it now, but maybe later, now that I have everything set up
<RX14> straight-shoota said just "puts (10 ** 0)" preproduces it
<RX14> although I haven't tested that
greengriminal has joined #crystal-lang
<RX14> >>10 ** 0
<DeBot> RX14: # => 1 - https://carc.in/#/r/3c22
<FromGitter> <bew> RX14 could you guide me a little on where (which file) I should put the specs for #5413 ?
<DeBot> https://github.com/crystal-lang/crystal/pull/5413 (Fix exit in at_exit handlers)
<RX14> yeah reproduces for me @asterite
<RX14> 10 ** 0 should obviously be 1
<RX14> on windows it's 10
<RX14> @bew not a clue
<RX14> that atexit stuff probably shouldn't be in kernel.cr
<RX14> it should be moved to something like src/crystal/at_exit_handlers.cr
<RX14> but thats probably out of scope of the PR...
<RX14> so idk
<RX14> i guess just make a kernel_spec.cr for now @bew
<FromGitter> <bew> following your resonning, I could make an at_exit_handlers_spec and in a later PR move the actual at_exit code to a new file?
<FromGitter> <bew> or is it better to keep kernel_spec and do all changes in the later pr?
<RX14> either use kernel_spec.cr in this PR
<RX14> or move the whole thing in this PR
<RX14> and honestly kernel.cr should go
<RX14> the top-level puts/etc/io stuff should be where STDIN is defined
<RX14> or in io.cr
<ua> guys im sure someone thought about it already, is it possible to have REPL under LLVM?
<RX14> and the rest should be in Process or wherever they fit
<FromGitter> <bew> and where should STDIN be defined? it's in kernel.cr for now
<RX14> uhh
<RX14> i thought STDIN was in crystal main.cr
<ua> i mean, could crystal have something like pry in the future
<FromGitter> <bew> at the very top
<RX14> @ua unlikely
<RX14> it's not to do with crystal being compiled, it's to do with crystal's type system
<ua> ah well
<ua> still i hope someone will figure it out some day
<RX14> we had a repl originally
<RX14> and we had to abandon it
<RX14> I don't believe that we'll ever get one again
<RX14> don't get your hopes up
<FromGitter> <bew> can you open a small issue for this please RX14? so we don't loose track of this (I think I don't have the full picture to make this issue myself)
<RX14> @bew it's just me rambling about crystal being a mess like always
<RX14> if I cared enough i'd make a PR myself
<RX14> just make a kernel_spec.cr
<RX14> and put it there
<FromGitter> <bew> yes sir, at your orders sir :)
<travis-ci> crystal-lang/crystal#8bc0dbc (master - Add macro methods to ProcNotation and ProcLiteral (#5206)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/324579226
<DeBot> https://github.com/crystal-lang/crystal/pull/5206 (Add macro methods to ProcNotation and ProcLiteral)
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <asterite> I debugged it just a bit
<FromGitter> <asterite> I'm pretty sure it's the mangling
<FromGitter> <asterite> the name ** is suspicious
<RX14> the mangling?
<RX14> wouldn't have suspected that
<FromGitter> <asterite> '*' gets replaeced with '.'
<RX14> @asterite does it not reproduce when you inline def ** ?
<FromGitter> <asterite> Search `def mangled_name` and `def self.safe_mangling`
<FromGitter> <asterite> It doesn't, and it doesn't if I change the name to foo or pow
<RX14> oh
<RX14> thats very very interesting
<FromGitter> <asterite> Basically, mangling is generating a symbol name in the object file
<RX14> I wouldn't have thought of that
<FromGitter> <asterite> in LLVM the name you can choose is quite permissive
<FromGitter> <asterite> and it works in unix/mac
<RX14> i guess it confuses the windows linker
<FromGitter> <asterite> but in Windows it doesn't, for some reason... so we replace some chars
<FromGitter> <asterite> but we are replacing '*' with '.' and '+' with ".."
<RX14> lol
<FromGitter> <asterite> so maybe there's a confusion there and two methods end up being named the same, or something like that
<RX14> if + is ..
<RX14> then ** is ..
<Vexatos> n i c e
<RX14> so they have the same symbol?
<FromGitter> <asterite> Maybe, I don't know... it seems `--emit llvm-ir` doesn't work when you cross compile :(
<FromGitter> <asterite> so that's something to improve
<Vexatos> if ** exists and ++ does not, why not swap those
<Vexatos> or just use completely different characters
<RX14> Vexatos, yeah that could work
<Vexatos> in the former case, . would be + .. would be * and .... would be **
<RX14> yeah
<RX14> @asterite Vexatos's suggestion is probably easy to test if it fixes it
<Vexatos> that would be the easiest solution probably
<FromGitter> <asterite> I'll try... I wanted to see why the LLVM ir isn't dumped
<RX14> @asterite side-bugs of side-bugs...
<FromGitter> <asterite> hehehe, yes
<FromGitter> <asterite> I changed the mangling and it worked :)
<FromGitter> <bew> nice catch 👌
<RX14> lol nice
<RX14> @asterite now PR *then* you can fix --emit llvm-ir
<FromGitter> <asterite> :-P
<RX14> i'm very glad it was this simple
<FromGitter> <asterite> I still don't know what mangling should we use
<FromGitter> <asterite> I used the suggestion above
<RX14> hopefully this solves printing floats as well
<FromGitter> <asterite> but I think it's better to use '.' for '*' and '...' for '+'
<FromGitter> <bew> RX14 CI is green for #4915 !
<DeBot> https://github.com/crystal-lang/crystal/pull/4915 (Start Refactor tool init specs)
alex`` has quit [Quit: WeeChat 1.9]
<FromGitter> <asterite> because all symbols in crystal have a '*' as a prefix, so it'll be '...' as a prefix for everything in windows, which is bad
<Vexatos> I wouldn't mind that
<Vexatos> it's not better or worse in any way
<Vexatos> so
<Vexatos> functionally, that is
<FromGitter> <asterite> Someone wants to file a PR with that? I got to go in a few minutes
<RX14> @asterite of all the things, name mangling is probably the least important
<FromGitter> <asterite> RX14: but you mentioned some bug with pcre, intermitent failing
<RX14> because as logn as it's consistent with itself it's fine
<RX14> long*
<RX14> and we have the pretty names in the DWARF
alex`` has joined #crystal-lang
<RX14> so it's not something i'd worry about
<FromGitter> <sdogruyol> awesome @asterite 👍
alex`` is now known as alexherbo2
<RX14> @bew no it's not?
<RX14> @bew #4915 needs a rebase
<DeBot> https://github.com/crystal-lang/crystal/pull/4915 (Start Refactor tool init specs)
<Vexatos> wouldn't that just be a two-line change
<Vexatos> wait that would only be a one-liner
rohitpaulk has joined #crystal-lang
<RX14> actually
<RX14> well
<RX14> Vexatos, if you went for the three dots option yes
<Vexatos> exactly
<Vexatos> I don't have a crystal set up right now but I would do a PR of this right from github, but it'd probably just be easier for RX14 to make the change and commit it
<RX14> i can't commit to master Vexatos
<Vexatos> right
<RX14> everything is PRed
<FromGitter> <codenoid> my grandmum is spanish
<Vexatos> protected branches are a thing now
<Vexatos> bless github
<Vexatos> RX14, I mean, if everyone else is too lazy to make a PR >_>
<Vexatos> I think the three-dot option is pretty good
<RX14> ok
<Vexatos> assuming none of those
<RX14> do it Vexatos
<Vexatos> characters turning into . are changed
<Vexatos> err
<Vexatos> have three-dot variants
<Vexatos> that code seems to mangle > and < etc too
<FromGitter> <codenoid> wow
<FromGitter> <codenoid> glad you back
<FromGitter> <codenoid> @aste
<FromGitter> <codenoid> @asterite
<Vexatos> RX14, would that also affect other chains of three of those characters?
<FromGitter> <codenoid> somebody want your signature
<Vexatos> e.g. ((( or >>>
<RX14> Vexatos, we have <<
<RX14> and >>
<FromGitter> <codenoid> crystal is awesome for building micro service
<Vexatos> as long as there are no chains of three
<Vexatos> and, well, ((( is not a function
<RX14> well
<RX14> wouldn't >> and << mangle the same
<FromGitter> <asterite> but we can have <<(arg)
<Vexatos> actually
<RX14> -> shl and shr
<FromGitter> <asterite> and that would be ...arg.
<RX14> yeah
<Vexatos> wouldn't all of this mangle the same
<RX14> the windows mangling does need a rethink
<FromGitter> <asterite> I think we have to find some safe way to do this
<FromGitter> <asterite> yeah
<RX14> just
<RX14> maybe just mangle them to .STAR.
<Vexatos> it replaces all those characters with .
<Vexatos> so aren't they all the same anyway?
<RX14> I think just manging them all to .NAME. will be the best way
<Vexatos> well, only * and + of those are functions so those are the only places where it mattered so far
<RX14> it'll be ugly as hell
<FromGitter> <asterite> or .1, .2, .3, etc. numbers can't appear after a dot in a method name
<Vexatos> but >> and << are as well
<RX14> but readable
<FromGitter> <asterite> but probably .STAR. is better, yes
<Vexatos> or am I missing something here
<RX14> and ugliness doesn't really matter to me on some tiny technical detail like this
<RX14> Vexatos, yes
<Vexatos> meaning << and >> and ** should all reproduce this bug
<RX14> it;s broken
<RX14> thats what we're discussing
<Vexatos> they should all parse as + on windows
<RX14> not parse
<Vexatos> well
<Vexatos> execute
<RX14> well the first symbol wins
<Vexatos> yes
<RX14> so it's undefined which will win
<Vexatos> yup
<Vexatos> apparently it's + though
<RX14> so yeah just
<Vexatos> yea just the full name
<RX14> seperate mangling for every symbol
<Vexatos> sounds like a gross but working solution
<RX14> now you need to think up of short names for < and >
<RX14> lol
<Vexatos> someone with a windows machine to test on should do that
<RX14> Vexatos, well I can test for you
<RX14> once I've had my lunch
<Vexatos> grt and lst
<Vexatos> if you want short names
<RX14> well
<RX14> idk
<RX14> it'll be ugly either way
<RX14> it's not being used as a less-than Vexatos so i'm a tad iffy on that
<RX14> but again:
<RX14> it'll be ugly either way
<Vexatos> not in the context of <<
alexherbo2 has quit [Quit: WeeChat 1.9]
<RX14> yeah
<Vexatos> it would mangle into, what
<Vexatos> lstlst?
<RX14> that'll be .lst..lst.
<FromGitter> <asterite> it's better if it's short: https://dlang.org/blog/2017/12/20/ds-newfangled-name-mangling/
<Vexatos> yes
<FromGitter> <asterite> (but I don't think we can reach those long names that D has)
<RX14> just md5 the symbol names lol
<RX14> then nobodyc an read anything
<FromGitter> <asterite> :-)
<RX14> actually
<RX14> thats a point
<FromGitter> <asterite> it also needs to be fast because it's generated for every name
<RX14> just hex it
<RX14> and then in the rare case debug info fails
<Vexatos> you mean the ascii code?
<RX14> it's not impossible to undo
<RX14> or jsut hex anything that's not an ascii char:
<RX14> so <foo> would be .ABfoo.CD
<Vexatos> all of those are ascii chars
<RX14> if 0xAB was ascii for <
rohitpaulk has quit [Ping timeout: 248 seconds]
<RX14> and 0xCD was ascii for >
<RX14> that could work
<RX14> and hex is pretty fast
<Vexatos> Now if I knew how to do that...
<RX14> well Vexatos
<RX14> the gsub block is Char -> String
<RX14> so you just do
<Vexatos> true
<RX14> if char.ascii_alphanumeric?
<RX14> then you do char
<RX14> else
<RX14> ".#{char.ord.to_s(16)}"
<FromGitter> <bew> but the char can be unicode, so not always 2 hex number
<RX14> actually make that with a dot on either side Vexatos
<RX14> then it'ds absolutely save in every circumstance
<RX14> @bew so?
<RX14> a) don't think we allow unicode in names
<FromGitter> <bew> we do
<RX14> b) even if it is 3 or 4 hex numbers, it still works
<RX14> it's just .ABCDEF.
<Vexatos> so basically this https://paste.asie.pl/rz4Z
<RX14> which is fine
<FromGitter> <bew> yeah if you add a . at the end it's ok
<Vexatos> could someone on winderps try this?
<RX14> Vexatos, I *think* that should work
<Vexatos> I don't have a windows computer to test on :I
<RX14> @bew yep
<RX14> Vexatos, push the commit to a fork and i'll test it
<FromGitter> <sdogruyol> let me check vexatos
<Vexatos> RX14, this is lowercase hex though though
<Vexatos> so < is 3c and not 3C
<FromGitter> <sdogruyol> need to shutdown my vm first though..
<FromGitter> <asterite> right, we'd need to check if unicode names work too... if not, probably dot followed by codepoint is good, so we could use that as a general solution
<RX14> Vexatos, boo hoo
<RX14> its fine
<RX14> Vexatos, actually
<Vexatos> so < is 3c and not 3C
<Vexatos> err
<Vexatos> sorry
<RX14> you can provide upcase: true
<Vexatos> pasted wrong window >_>
<RX14> to_s(16, upcase: true) Vexatos
<Vexatos> yes
<RX14> see crystal is perfect
<FromGitter> <sdogruyol> haha lol
<FromGitter> <sdogruyol> vexatos, it works
<Vexatos> nice
<FromGitter> <sdogruyol> tried it on puts 10 ** 0
<RX14> @sdogruyol and you tested that it didn't work before?
<FromGitter> <sdogruyol> yes?
<FromGitter> <sdogruyol> I'm sorry, what's your point?
<FromGitter> <ArtLinkov> is there a command in crystal which is similar to shape from python?
<FromGitter> <ArtLinkov> yeah
<FromGitter> <bew> I'm not sure I understand exactly what it does, maybe you're looking for `Enumerable#in_groups_of` https://crystal-lang.org/api/0.24.1/Enumerable.html#in_groups_of(size%3AInt%2Cfilled_up_with%3AU%3Dnil)forallU-instance-method (note: Array is an Enumerable, so all methods in Enumerable are available for Array)
<FromGitter> <ArtLinkov> lets say I have an array(array(array(T))) and I want to create a similar object but empty or with other values. I can use shape to create it
<RX14> @sdogruyol my point was you need to make sure you're testing it correctly before you can test it's fixed :)
<RX14> that's all
<FromGitter> <sdogruyol> I'm pretty aware of that RX14
<Vexatos> commit message might be too long, I don't know
<FromGitter> <sdogruyol> not sure what made think that I'm not doing that
<FromGitter> <sdogruyol> made you*
<RX14> just making sure...
<FromGitter> <sdogruyol> thank you vexatos
<RX14> Vexatos, commit messages should be imperative
<Vexatos> It makes me feel uncomfortable that I am about to PR something I have not tested myself
<RX14> and less than 52 chars
<RX14> Change symbol mangling on windows to avoid conflict
<RX14> that's what I would have called it
<Vexatos> all my repos usually have fairly long commit messages
<Vexatos> so that's why I asked :P
<FromGitter> <bew> @ArtLinkov I don't think we have this in the stdlib, also it looks like a very specific thing used for datasets, change their shape etc.. maybe a shard oriented in this field might do that idk. Let's ping @bararchy maybe he already had to handle this kind of things
<RX14> the implementation details are in the diff Vexatos
<RX14> the intention should be in the commit message
<RX14> commit messages are an art
<Vexatos> well, rename pushed
<RX14> Vexatos, no full stops either
<RX14> it's not a sentence
<FromGitter> <straight-shoota> details could be in a second line but I think it is pretty obvious what
<FromGitter> <straight-shoota> I can also confirm that it works if that helps you feel more comfortable
<FromGitter> <bew> @Vexatos my best resource on writing a good commit message is https://chris.beams.io/posts/git-commit/ ;)
<FromGitter> <ArtLinkov> @bew thanks, I'm actually working with him lol :) I'll ask
<FromGitter> <bew> ah lol ^^ I won't be able to help more, gl
<Vexatos> @bew I am used to writing reports of 10-30 pages in size, short and concise is not my strong suit :P
<RX14> Vexatos, it just takes practice
<Vexatos> Probably
<FromGitter> <straight-shoota> now time_spec passes with Vexatos' patch 👍
<FromGitter> <sdogruyol> awesome
<Vexatos> more like RX14's patch
<FromGitter> <straight-shoota> except for the specs that expect an exception
<RX14> yay @straight-shoota
<RX14> @straight-shoota try and revert the commit that I made which changes Float::Printer
<Vexatos> was there an issue for that which this PR closes?
<RX14> and see if specs fail or no
<FromGitter> <straight-shoota> Vexatos, no
<Vexatos> ok
<RX14> we're not that organised Vexatos
<Vexatos> so, should I PR it now?
<FromGitter> <sdogruyol> I think we should thank @asterite for debugging that fast :P
<RX14> yeah
<Vexatos> to master, right?
<RX14> Vexatos, yes
<FromGitter> <straight-shoota> yes @sdogruyol he even tried to install a vm with windows working on his wife's mac in spanish :P
<FromGitter> <sdogruyol> isn't that awesome :)
<FromGitter> <straight-shoota> great to have you around, @asterite
<FromGitter> <straight-shoota> RX14 I can't try it right now
<FromGitter> <straight-shoota> later
<crystal-gh> [crystal] Vexatos opened pull request #5518: Change symbol mangling on Windows to avoid conflicts (master...windows-mangle-fix) https://git.io/vbjQe
<RX14> ok @straight-shoota
<RX14> never mind then
<RX14> i'll do it
<Vexatos> thanks bot D:
<FromGitter> <asterite> ArtLinkov: typeof(array).new
<FromGitter> <asterite> To create exactly the same type
rohitpaulk has joined #crystal-lang
<FromGitter> <asterite> My wife has windows in her machine, I used that, not a vm
<Vexatos> This change is much nicer than the . and .. mangling
<Vexatos> you can decode it which is a big plus
alex`` has joined #crystal-lang
snsei has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 250 seconds]
alex`` has quit [Ping timeout: 255 seconds]
alex`` has joined #crystal-lang
DTZUZU has quit [Ping timeout: 256 seconds]
<FromGitter> <vpereira> there is a reason why Enumerable doesnt implement inject?
<FromGitter> <bew> what is inject for? adding entries?
<FromGitter> <vpereira> hm accumulating
<FromGitter> <vpereira> [1, 2, 3, 4].inject(0) { |result, element| result + element } # => 10
<FromGitter> <vpereira> build reduce array, maybe
<RX14> isn't that reduce?
<RX14> yes that's a fold
<RX14> so reduce
<FromGitter> <vpereira> true, its a alias in ruby i think
<FromGitter> <vpereira> not sure thou
<Vexatos> @asterite I did the changes to the PR [I think]
<RX14> we don't do aliases in crystal @vpereira
<FromGitter> <bew> @vpereira https://crystal-lang.org/api/0.24.1/Enumerable.html#reduce(memo%2C%26block)-instance-method
<RX14> we always have one name
<FromGitter> <bew> or simply https://crystal-lang.org/api/0.24.1/Enumerable.html#reduce(%26block)-instance-method (with a starting value of 0)
<crystal-gh> [crystal] RX14 closed pull request #5516: Remove old legacy checks in callstack specs (master...fix-callstack-spec-for-last-crystals) https://git.io/vbjwQ
<FromGitter> <vpereira> hm, let me see. reduce doesnt allow me to pass two params to the block
<RX14> two?
<FromGitter> <vpereira> sure it does
<RX14> oh to the block, well they all take 2 params
<FromGitter> <vpereira> if it works then im good [1, 2, 3, 4, 5].reduce { |acc, i| acc + i }, thank you
<FromGitter> <bew> hmm no, the start valud is not 0, it's the first value instead
<FromGitter> <vpereira> I'm implementing some standard deviation, variance etc in the Enumerable, I'm sure we have a shrad for that, right?
<FromGitter> <vpereira> @bew what you mean? the ```[1, 2, 3, 4, 5].reduce { |acc, i| acc + i }``` wont work?
<FromGitter> <vpereira> its working https://gist.github.com/vpereira/3595face7ed8988416f5cad8eb6ed31b thank you
<FromGitter> <bew> no, your example will work fine! I mentioned first the version of reduce which take an initial value, like in `[1, 2].reduce(3) { |acc, i| acc + i }` wich gives 6 (note the initial value of the accumulator), and I said just after that the other form without initial value would have an accumulator initialized to 0, which is false, it is initialized to the first value of the enumerable
<FromGitter> <vpereira> ah ok, thank you @bew !
DTZUZU has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 272 seconds]
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]
alex`` has quit [Quit: WeeChat 1.9]
<FromGitter> <asterite> vpereira: sum already exists in Enumerable
<travis-ci> crystal-lang/crystal#2d7c774 (master - Remove old legacy checks in callstack specs (#5516)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/324638455
<DeBot> https://github.com/crystal-lang/crystal/pull/5516 (Remove old legacy checks in callstack specs)
<Vexatos> @asterite fixed, sorry >_>
<FromGitter> <asterite> no need to say sorry! you are contributing and even the first code could be merged and improved later
<Vexatos> maybe I shouldn't mention that this is actually the first time I ever wrote proper crystal code :I
<Vexatos> outside of random helloworlds, that is >_>
<FromGitter> <asterite> :-)
<Vexatos> Didn't even know String.build was a thing, heh
<FromGitter> <asterite> Just one last thing: it seems '_' isn't ascii_alphanumeric, and that's a very common char
<Vexatos> in funcnames? yes
<FromGitter> <asterite> so maybe `if char.ascii_alphanumeric? || char == '_'`
<Vexatos> I would... yes
<Vexatos> exactly
<Vexatos> there you go
<FromGitter> <asterite> cool, thanks!
crse[m] has joined #crystal-lang
jokke has quit [Quit: WeeChat 1.9]
Poeticode has left #crystal-lang ["The Lounge - https://thelounge.github.io"]
<RX14> aargh
alex`` has joined #crystal-lang
<RX14> I wish circleCI wasn't a bottleneck
<RX14> we seem to be limited at one concurrent job
<RX14> and when they take 20 mins...
<RX14> perhaps we could nag them for more resources....
alex`` is now known as alexherbo2
alexherbo2 has quit [Client Quit]
jokke has joined #crystal-lang
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <asterite> if it's for the last pr, it can be merged. That code only runs on windows so even if you have a typo there or some bug it won't get caught by ci
dragonkh has joined #crystal-lang
alex`` has joined #crystal-lang
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vNeT2
<crystal-gh> crystal/master 288af4b Benoit de Chezelles: Refactor init spec (#4915)
<RX14> @asterite no it's a general complaint
<dragonkh> evening :)
alex`` has quit [Quit: WeeChat 1.9]
faustinoaq has joined #crystal-lang
flaviodesousa has quit [Ping timeout: 268 seconds]
aroaminggeek has quit [Ping timeout: 240 seconds]
alex`` has joined #crystal-lang
rohitpaulk has joined #crystal-lang
dragonkh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dragonkh has joined #crystal-lang
bmcginty has quit [Ping timeout: 240 seconds]
rohitpaulk has quit [Ping timeout: 260 seconds]
bmcginty has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
alex`` has quit [Quit: WeeChat 1.9]
aroaminggeek has joined #crystal-lang
aroaminggeek has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<RX14> @asterite btw, if you're investigating why --emit doesn't work when cross-compiling, can you solve the bc_flags file being created when cross-compiling too...
<FromGitter> <asterite> what's wrong with that?
<RX14> well
<RX14> I didn't ask for a random bc_flags file being created @asterite
<RX14> i never use it and it just gets in the way
<RX14> it seems a bug to me that it's created in the first place
<RX14> i mean the bc_flags gets created in the current directory
cremes has quit [Quit: cremes]
<FromGitter> <asterite> Oooh... yeah, that's not good
<RX14> @asterite just if you're hacking on that part of the compiler anyway I thought i'd give you a heads up
<crystal-gh> [crystal] bew opened pull request #5520: Remove `bin/crystal` usage for init tool specs (master...spec-init-programatically) https://git.io/vNeWq
<FromGitter> <asterite> I just found out that the `**` method mangling was conflicting with `>>`
<RX14> oh yeah that makes sense
<RX14> 10 >> 0 or 10 << 0 would both be just 10
aroaminggeek has joined #crystal-lang
<Vexatos> wasn't that what I predicted a few hours ago?
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vNe88
<crystal-gh> crystal/master 44a4c63 Vexatos: Change symbol mangling on Windows to avoid conflicts (#5518)
<Vexatos> yaay
<RX14> Vexatos, but + was becoming .. as well so it could have been 10 + 0
<RX14> iirc at least
<Vexatos> yea I suggested that ** << >> and + would all be the same likely
<FromGitter> <Fryguy> basically *any* multi-char would mangle to `..` before the PR by Vexatos
<FromGitter> <Fryguy> yeah that ^^ :)
<travis-ci> crystal-lang/crystal#44a4c63 (master - Change symbol mangling on Windows to avoid conflicts (#5518)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/324731247
<DeBot> https://github.com/crystal-lang/crystal/pull/5518 (Change symbol mangling on Windows to avoid conflicts)
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<DeBot> https://github.com/crystal-lang/crystal/pull/5520 (Remove `bin/crystal` usage for init tool specs)
<FromGitter> <bew> There is not mention of a failed spec
<FromGitter> <bew> there is a "Unhandled exception in spawn:" from an HTTP spec
<RX14> well
<RX14> it exited early
<RX14> there's nowhere near the correct amount of compiler specs that were run
<RX14> so clearly it's broken
<FromGitter> <bew> any way to know where?
<RX14> no
<FromGitter> <bew> :/
<FromGitter> <bew> ah I may have an idea.. hold on
<FromGitter> <bew> ok it's my fault, my pr just doesn't work x)
<FromGitter> <bew> not fully at least
rohitpaulk has joined #crystal-lang
jnyw has joined #crystal-lang
<FromGitter> <bew> anyone using vim succeeded in having the i_know_what_im_doing flag set to have proper error reporting inside crystal sources?
rohitpaulk has quit [Ping timeout: 260 seconds]
<RX14> @bew just use bin/crystal
<RX14> that's all you need to do
<FromGitter> <bew> yes but no, I want to use the binary from my package manager, not the one I'm working on
<RX14> ...why?
<FromGitter> <bew> why not?
<RX14> because it's harder for no gain?
<FromGitter> <bew> well, when I work on my personal projects I want to use the latest release of the compiler, not the master version
<FromGitter> <bew> adding just the flag would allow proper error reporting for crystal sources, and do nothing for my projects
<FromGitter> <bew> it seems simpler to me
<RX14> which compiler to use should be per-project...
<FromGitter> <bew> hmm maybe yes
<FromGitter> <bew> yes that would work, will try to make it use latest release for everything, and bin/crystal for the compiler's sources
alex`` has joined #crystal-lang
<crystal-gh> [crystal] jhass closed pull request #5408: Fixed set-cookie regex to allow whitespace (master...master) https://git.io/vbXqU
aroaminggeek has left #crystal-lang ["Textual IRC Client: www.textualapp.com"]
<crystal-gh> [crystal] asterite opened pull request #5521: Improve cross compilation (master...feature/improve-cross-compilation) https://git.io/vNePz
<crystal-gh> [crystal] asterite opened pull request #5522: Benchmark.ips: show allocated bytes per operation (master...feature/benchmark-ips-allocs) https://git.io/vNeXk
<RX14> @asterite I think we might need va_list support for the windows port...
<RX14> stuff like for example snprintf just isn't a symbol on windows
<RX14> you *have* to use vsnprintf
<RX14> the snprintf is an inline def in the header files
<RX14> which calls vsnprintf
<RX14> and va_list is just a pain...
<RX14> I wish we didn't need printf...
<FromGitter> <asterite> there's a pr from makenowjust to support that, I already approved it some months ago
<RX14> i don't think so
<RX14> from my limited understanding that's unpacking va_list only
<RX14> I think it's only a limited implementation for callbacks
<FromGitter> <asterite> it's not this? https://github.com/crystal-lang/crystal/pull/5103
<RX14> i don't think so
<RX14> there's no way to add things to a list there @asterite
<RX14> well
<travis-ci> crystal-lang/crystal#2dcc1b9 (master - Fixed set-cookie regex to allow whitespace (#5408)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/324786126
<DeBot> https://github.com/crystal-lang/crystal/pull/5408 (Fixed set-cookie regex to allow whitespace)
<RX14> I don't understand va_list peroperly myself
<FromGitter> <asterite> why do we need c's printf?
<FromGitter> <asterite> I guess it's for String::Formatter
<FromGitter> <asterite> if that's the case, we could probably use Float::Printer for that
<RX14> it's *for* Float::Printer
<RX14> grisu3 fails on ~0.5% of floats
<RX14> where we have to fall back to snprintf
<RX14> I'm not sure of the state-of-the-art "complete" float printer algorithm
<FromGitter> <asterite> ah... then I don't know
<RX14> if I was I could just implement that
<RX14> and get rid of the snprintf
<RX14> hmm
<RX14> actually @asterite I think I just didn't understand va_list
<RX14> I thought with vsnprintf you'd "create" a va_list instance and pass it to vsnprintf
<RX14> but from my reading it seems to be the only way to create a va_list is to have a traditional variadic function
aaaaaa__ has joined #crystal-lang
hightower4 has joined #crystal-lang
<RX14> yeah vsnprintf links...
rohitpaulk has joined #crystal-lang
<RX14> well, time to implement dragon4...
<RX14> at least I'm at uni now so I can read it
<RX14> stupid journals
rohitpaulk has quit [Ping timeout: 264 seconds]
cremes has joined #crystal-lang
faustinoaq has quit [Quit: IRC client terminated!]
faustinoaq has joined #crystal-lang
shelvacu has quit [Quit: Goodbye for now]
aaaaaa__ has quit [Ping timeout: 260 seconds]
shelvacu has joined #crystal-lang
<RX14> never mind, I don't have nearly the time to understand this
<RX14> i'll hack snprintf in with vsnprintf and makenowjust's patch
<crystal-gh> [crystal] RX14 opened pull request #5524: Add Process.exit stub on windows (master...feature/windows-exit) https://git.io/vNeQU