ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.1 | Fund Crystal's development: | GH: | Docs: | API: | Gitter:
<FromGitter> <marksiemers> hmm, what version of crystal and shards do you have?
<FromGitter> <HCLarsen> 1) 23.1
<FromGitter> <marksiemers> Is this available in a repo? or a gist?
<FromGitter> <HCLarsen> Is what available?
<FromGitter> <marksiemers> The code you're working with
<FromGitter> <HCLarsen> No, I didn't push it on account that I'm having an issue with the shard I'm trying to incorporate.
<FromGitter> <HCLarsen> But I gotta go anyways.
<FromGitter> <marksiemers> @hightower - I messed with trying to capture generic blocks a couple months ago and couldn't get it. LMK if you do. ⏎ What I did learn was about the different ways to capture blocks, if it helps, you can take a look here: ⏎
snsei has joined #crystal-lang
<hightower2> marksiemers: no luck on my side either
snsei has quit [Remote host closed the connection]
<hightower2> Is there a way to define some code that will be executed during initialize, but without having to actually do 'def initialize' and then forcing subclasses to call 'super'? Esentially, I'm looking for something like specifying "@var = ..." at class level, but something that would work for code, not just instance vars.
snsei has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
mbarbar has joined #crystal-lang
dhk has joined #crystal-lang
faustinoaq has joined #crystal-lang
snsei has joined #crystal-lang
<FromGitter> <marksiemers> I'm pretty sure crystal supports class variables - `@@var`
<FromGitter> <marksiemers> ⏎ It sounds like it could work for your use case.
<FromGitter> <marksiemers>
<hightower2> marksiemers: note my comment "something that would work for code, not just instance vars"
<hightower2> Is it possible to call a captured block using, but have it work equivalent to 'with self yield'?
snsei has quit [Remote host closed the connection]
ashirase has quit [Ping timeout: 248 seconds]
hightower3 has joined #crystal-lang
ashirase has joined #crystal-lang
hightower2 has quit [Ping timeout: 248 seconds]
dhk has quit [Quit: Leaving]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 250 seconds]
mbarbar has quit [Ping timeout: 256 seconds]
lacour has quit [Quit: Leaving]
vikaton has joined #crystal-lang
DTZUZU has quit [Quit: WeeChat 1.9]
<FromGitter> <marksiemers> I'm not sure about that. Is it possible to provide a code sample - something that isn't working but shows what you want to do?
<FromGitter> <jwaldrip> Anyone having issues building for release in travis?
DTZUZU has joined #crystal-lang
DTZUZU has quit [Client Quit]
faustinoaq has quit [Ping timeout: 248 seconds]
DTZUZU has joined #crystal-lang
<FromGitter> <Yive> is it possible to have an if statement with unless? as in `if var == 32 unless var2 == 64` for example
<FromGitter> <jwaldrip> no.. just use a !
<FromGitter> <jwaldrip> well... maybe...
<FromGitter> <jwaldrip> but not like that
<FromGitter> <jwaldrip> ```if true ⏎ puts "if unless" ⏎ end unless false``` []
<FromGitter> <jwaldrip> You would have to put the unless at the end of the block.
<FromGitter> <mjago>
<FromGitter> <Yive> thank you, that worked perfectly. Though I ended up just going with a different method all together
faustinoaq has joined #crystal-lang
DTZUZO has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 272 seconds]
alex`` has joined #crystal-lang
alex`` has quit [Client Quit]
illyohs has quit [Ping timeout: 260 seconds]
alex`` has joined #crystal-lang
csk157_1 has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
DTZUZO has quit [Ping timeout: 248 seconds]
<FromGitter> <rumenzu> Morning everyone
<faustinoaq> Morning, 2:00 AM here :-)
<FromGitter> <rumenzu> I just wanted to say I defended my PhD two days ago with software written in Crystal <3<3
<faustinoaq> Excellent, congrats!
<faustinoaq> I'm still an undergraduate student :D
<FromGitter> <rumenzu> Thanks a lot!
<FromGitter> <rumenzu> Where R u studying ?
<Yxhuvud> rumenzu: Congrats! What was your topic?
<FromGitter> <rumenzu> theory of modeling and simulation, the goal was to formalize multi-agent systems
<FromGitter> <rumenzu> and thank you!
<faustinoaq> @rumenzu I'm from Panama, I'm studying, Computer Science in University of Panama, but in next years (2019-2020) I want to take some grade, maybe a Phd in some foreign university, What country do you recommend? I was thinking on Japan or Canada :-)
<Yxhuvud> multi agent in a discrete or continous time?
<FromGitter> <rumenzu> @yxhuvud continuous time
<Yxhuvud> cool
<FromGitter> <rumenzu> @faustinoaq unfortunately I have no experience outside France so I can't recommend anything. But I think it will depends mostly on the topic you choose
<FromGitter> <mjago> @rumenzu 🎓 🎉 👍 Nice one!
<faustinoaq> @rumenzu> Is your PhD related to ?
<faustinoaq> @rumenzu Nice, no problem ;-)
<FromGitter> <rumenzu> @faustinoaq yes, this is the simulation kernel
<FromGitter> <rumenzu> @mjago thanks!
<FromGitter> <rumenzu> Hopefully I'll have some time to contribute to Crystal now
<FromGitter> <rumenzu> I have to go, i'll catch up later with you guys
rohitpaulk has quit [Ping timeout: 248 seconds]
<faustinoaq> I hope crystal is 1.0.0 before I defend my thesis. A book about crystal will be good too: :-)
flaviodesousa has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
mark_66 has joined #crystal-lang
<FromGitter> <yxhuvud> @rumenzu : regarding, did you consider some more efficient heaps that have better complexities and speed in practice, like pairing heaps?
alex`` has quit [Quit: WeeChat 1.9.1]
rohitpaulk has joined #crystal-lang
<FromGitter> <bew> hightower2: if you still haven't found, when you capture a block, you need to specify it's type (at least the args type). And no you can't have a block that can be captured and `with .. yield`ed, as with..yield work only for a non-captured block.
claudiuinberlin has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 272 seconds]
rohitpaulk has joined #crystal-lang
mbarbar has joined #crystal-lang
vikaton has quit [Quit: Connection closed for inactivity]
<hightower3> faustinoaq, hehe, was just buying something from pragprog and after entering recipient data and clicking Next, ran into unprocessed page: PP.update_checkout_content("\n<div class=\"row checkout-box\" id=\"my_details\"><div ...
<hightower3> So can't continue :)
<faustinoaq> XD
<FromGitter> <imonmyown> @hightower3 I'm sure support will be willing to help
DTZUZO has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
<RX14> So it seems more likely 0.24.1 will be released this week
<FromGitter> <bew> 🎉
<RX14> Can't promise anything but I've had a chat with the Manas guys and they're working on it
<FromGitter> <sdogruyol> @RX14 awesome
<FromGitter> <sdogruyol> did we get your Windows PR in for 0.24.1?
<FromGitter> <imonmyown> @RX14 sounds great! Is this ( the current release notes page?
<FromGitter> <sdogruyol> no, it's for 0.24.0, we probably have more to add
<FromGitter> <imonmyown> @sdogruyol cool, will be looking forward to it
rohitpaulk has quit [Ping timeout: 272 seconds]
handicutsman has joined #crystal-lang
handicraftsman has quit [Ping timeout: 255 seconds]
<crystal-gh> [crystal] mverzilli pushed 1 new commit to master:
<crystal-gh> crystal/master 80a975c Chris Hobbs: Version 0.24.1 (#5358)
<crystal-gh> [crystal] mverzilli closed pull request #5358: Version 0.24.1 (master...0.24.1-changelog)
<travis-ci> crystal-lang/crystal#80a975c (master - Version 0.24.1 (#5358)): The build was broken.
<FromGitter> <yxhuvud> nice! I hope it is out before advent of code have an exercise where I need a queue, the array improvements will be nice to get
<FromGitter> <sdogruyol> Wow, @mverzilli just tagged 0.24.1 🎉
<FromGitter> <yxhuvud> \o/
<FromGitter> <rumenzu> @yxhuvud yes, more tree-based event sets will be implemented (probably pairing heap and fibonacci heap) but this is not a priority, as the multi-list based schedulers (calendar queue and ladder queue) are quite efficient
rohitpaulk has joined #crystal-lang
hightower3 has quit [Ping timeout: 260 seconds]
<foxxx0> hm
<foxxx0> what is the crystal equivalent of ruby's Array(Int32)#reduce(:+)?
<foxxx0> i just want the sum of all array elements
<FromGitter> <bew> `Array#sum`?
<foxxx0> oh
<foxxx0> must have missed that in the docs
<FromGitter> <yxhuvud> `reduce {|a, b| a + b}` will also work.
<foxxx0> but i bet #sum is more efficient
<FromGitter> <yxhuvud> I doubt it. I'd actually bet they are totally equivalent.
<RX14> yup
<RX14> llvm in release mode should optimize those to be the same
<FromGitter> <bew> looking at the code, sum is a reduce in the end ^^
rohitpaulk has quit [Ping timeout: 264 seconds]
jop_ has joined #crystal-lang
jop_ has quit [Client Quit]
alex`` has joined #crystal-lang
<FromGitter> <paulcsmith> 1) 24.1 was tagged but I thought 0.24 wasn’t even out yet? Or maybe I am misunderstanding the release process?
<RX14> 0.24.0 is a prerelease
<RX14> its been out fo a month
<RX14> but its a prerelease
<FromGitter> <paulcsmith> Sorry I meant “out” as in normal release by ore release. But I just saw your comment on 0.24.1 and I agree getting it out would be great to reduce confusion 👍
rohitpaulk has joined #crystal-lang
<FromGitter> <yxhuvud> the confusion is due to the version comparison at some stage doesn't or didn't support 0.24.rc1
<FromGitter> <mjago> Is there anything in the standard library for sizing strings containing `combining accents’?
<FromGitter> <mjago> Currently I’m doing:
<FromGitter> <mjago> ```code paste, see link``` []
<FromGitter> <yxhuvud> don't think so, but check out - it may have something for you
<FromGitter> <mjago> Thanks!
<crystal-gh> [crystal] RX14 closed pull request #5333: Move File and IO::FileDescriptor's platform-specific parts to Crystal::System (master...feature/io-crystal-system-2)
mbarbar has quit [Ping timeout: 256 seconds]
<travis-ci> crystal-lang/crystal#5fd965e (master - Separate platform-specific parts of File): The build is still failing.
<jokke> i managed to link my crystal file statically btw:
<jokke> s/file/program/
<jokke> ugly but works!
<jokke> oh
<jokke> that's... a gem file
<RX14> you know there's a --static flag now jokke
<RX14> also thats still a bad way to do it
<RX14> just pass --link-flags to crystal build
<RX14> even in 0.23.1
<jokke> no
<jokke> i can't
<jokke> it wont link like that
<RX14> why?
<crystal-gh> [crystal] RX14 closed pull request #4955: Remove markdown, use markd shard in compiler (master...refactor-markdown)
<jokke> because libzmq which is correctly included by crystal uses libsodium. libsodium isn't added by crystal to the linker flags and if i add it manually it is before -lzmq on the command line and as such gets loaded after zmq which then can't find any symbols from the lib
<RX14> so
<RX14> thats what pkg-config solves
<jokke> how?
<jokke> i'm telling you adding -static to --link-flags doesn't work
<jokke> i tried to make it work for hours
<RX14> pkg-config solves library dependencies
<jokke> yeah i thought so too
<RX14> so if it doesn't work then either you don't have pkg-config installed
<RX14> or your pc scripts are broken
<jokke> pc scripts?
<RX14> in which case contact your distro
<jokke> precompiler?
<RX14> package config
<jokke> it doesn't work on arch nor on ubuntu
<jokke> rror: execution of command failed with code: 1: `g++ "${@}" -o '/home/jokke/code/meso/energybox/zmq_broker/bin/zmq_broker' -rdynamic -static -lzmq -lpcre -lgc -lpthread /usr/lib/crystal/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib`
<jsn-> -- can anyone please help me, why doesn't this work?
<RX14> where's all the pkg-config invocations jokke?
<jokke> that's the command shards build --static uses
<jokke> RX14: i thought crystal does that
<jokke> jsn-: good question
<RX14> jokke, oh yeah it seems zmq's pc is broken
<jokke> RX14: :/
<RX14> they called it libzmq.pc
<RX14> not zmq.pc
<RX14> as is convention
<RX14> ans therefore broke everything
<RX14> go figure
<jokke> :D
<jokke> pkg-config libzmq --libs # => -lzmq
<RX14> use --static
<RX14> which the compiler does do
<RX14> if you provide --static
<jokke> ooohhh
<RX14> actually maybe it doesn't
<RX14> which is probably a bug
<jokke> seems it doesnt
<jokke> yeah
<RX14> darn
<RX14> my bad
<jokke> should be easy to fix though
<jokke> i see if i can make a pr
<RX14> it only does so if you provide static: true in the @Link attr
<jokke> hm
<RX14> ok, PR coming up
<jokke> RX14: you're doing it?
<RX14> yeah
<jokke> cool!
<jokke> thanks!
<RX14> you'll still need to fix the pkg-config weirdness though
<jokke> RX14: no, the shard links the correct lib
<jokke> well "correct"
<RX14> lit's using @[Link("libzmq")]
<jokke> yeah
<RX14> :(
<RX14> bad zmq
<jokke> bad bad
<RX14> darnit
<RX14> it seems like it's literally 50/50
<jokke> RX14: another thing: it seems that gcc isn't able to link it. the right way to tackle it would be to pass CC=g++ right?
<RX14> half the libs use pkg-config with lib
<RX14> and half don't
<jokke> m(
hightower2 has joined #crystal-lang
<RX14> fantastic
<RX14> absolutely fantastic
<jsn-> -- even worse, this doesn't work, and this does work
<jsn-> seems like a bug, why would a macro make the compiler lose the ability to infer that the instance var is always initialized
<jokke> jsn-: well the check for initialization is probably run before macros are evaluated
<jokke> you could just initialize with defaults before calling the macro but that'd be a pretty ugly workaround
<jsn-> -- this one is especially funny, it says it can't infer the type from "@b = 1" and immediately recommends to use "@b = 1" to avoid that
<jsn-> jokke, but macro expansion errors, if there any, are triggered before the type inference error
<jokke> :)
<faustinoaq> jsn- Take a look Not the best way to solve it, but works :)
<jsn-> faustinoaq, yeah, apparently that's what JSON.mapping does, wholesale macro-defined constructor
<jsn-> i needed a macro to DRY some statements *inside* a constructor, and apparently it can't be done
<faustinoaq> jsn-, maybe because macros are analyzed after semantic (new), look at compilation stats
<FromGitter> <LuckyChicken91_twitter> can I store methods in an array somehow?
mark_66 has quit [Remote host closed the connection]
sdf_ has joined #crystal-lang
<FromGitter> <LuckyChicken91_twitter> can I create the methods directly in the array?
sdf_ has quit [Client Quit]
flaviodesousa has quit [Ping timeout: 248 seconds]
p0p0pr37 has quit [Remote host closed the connection]
<FromGitter> <marksiemers> I don't know about methods, but you could store Procs in an array
<FromGitter> <marksiemers> Or a Tuple
<FromGitter> <marksiemers> Do you have an example of a couple methods that you want to store?
<jsn-> if i have a fiber doing HTTP::Websocket#run, is there any way to stop it from the outside? (not from e.g. on_message / on_close)
<jsn-> or if I have e.g. TCPSocket, and want to catch a situation when nothing comes from it for some time, how do I do that?
<FromGitter> <LuckyChicken91_twitter> @marksiemers ⏎ like this ⏎ ⏎ ```code paste, see link``` []
claudiuinberlin has quit [Quit: Textual IRC Client:]
<FromGitter> <LuckyChicken91_twitter> oooh i understand the procs now
<FromGitter> <LuckyChicken91_twitter> thank you
Poetichristmas is now known as Poeticode
faustinoaq has quit [Ping timeout: 260 seconds]
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <LuckyChicken91_twitter> how can I have an empty array where i can insert everything?
<FromGitter> <LuckyChicken91_twitter> I dont want to specifie every single type
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
faustinoaq has joined #crystal-lang
<faustinoaq> @LuckyChicken91_twitter Maybe something like
<FromGitter> <azbshiri> Building a RESTful API with Crystal Raw
alex`` has quit [Ping timeout: 246 seconds]
<FromGitter> <LuckyChicken91_twitter> nice
<FromGitter> <unreadable> does anyone know an automatic blockchain client?
<FromGitter> <unreadable> library*
<FromGitter> <unreadable> no matter the language
<Papierkorb> .. automatic?
<FromGitter> <unreadable> somethign that can do trades without the need of a human
<FromGitter> <unreadable> basically a bo
<FromGitter> <unreadable> y
<FromGitter> <unreadable> bot*
<Papierkorb> Yeah as if people would do that and then OSS it
<FromGitter> <unreadable>
<Papierkorb> And that has nothing to do with "blockchain", that's just using the markets API
<FromGitter> <unreadable> this should do the trick
alex`` has joined #crystal-lang
p0p0pr37 has joined #crystal-lang
p0p0pr37 has joined #crystal-lang
<FromGitter> <sdzyba> does anyone know when to expect 0.24.1 on repos? ⏎ I hope 0.24.0 was skipped there since it's a "prerelease", not because repos aren't maintained anymore.
<RX14> 0.24.1 has been tagged, not released
<RX14> we know what we're going to release
<RX14> we havent released it yet
<RX14> it'll release once we have packages built and everything is ready
<FromGitter> <sdzyba> I see, thanks
<FromGitter> <unreadable> hey RX14, what's going on with windows support? It'll be implemented the same way rust does it?
<RX14> i dont know how rust does it at all
illyohs has joined #crystal-lang
<FromGitter> <unreadable> better than vim
<FromGitter> <unreadable> it also has crystal pupligns oO
faustinoaq has quit [Ping timeout: 256 seconds]
<RX14> >better than vim
tilpner has quit [*.net *.split]
yopp has quit [*.net *.split]
<RX14> thats your opinion
tilpner has joined #crystal-lang
yopp has joined #crystal-lang
<FromGitter> <unreadable> yeah, for sure and I've arguments on that, but that's not the point
<Papierkorb> "X > Y" "That's your opinion" "That's not the point" wat
handicutsman has quit [Ping timeout: 240 seconds]
handicraftsman has joined #crystal-lang
<Yxhuvud> signs I am not running 0.24 yet: I just won a second on my AoC solution by extracting 3 hash lookups to a variable.
<FromGitter> <bew> @unreadable neovim can have crystal plugin too
<FromGitter> <unreadable> ikr
<FromGitter> <bew> but micro seems great though ;)
<FromGitter> <paulcsmith> Punchcards FTW. Who needs all of those fancy "plugins" and "syntax highlighting"
<RX14> Yxhuvud, hashes in 0.24.1 are slower I think lol
<Yxhuvud> With numbers too? Really? Not having conflicts all the time shoudl be noticable.
<Yxhuvud> for strings or whatever I could see it
<RX14> oh idk about numbers
<Yxhuvud> look at the nice distribution graph for numbers in funny falcons PR.
<Yxhuvud> that ysbaddaden did
<RX14> doesnt halp if your hashing algorithm is 2000 times slower
<Yxhuvud> depends on how many entries there is in your hash table, and how many cache misses you get by going though the linked list of collisions
<Papierkorb> RX14: the new algo is that much slower?
<Papierkorb> Thought it wasn't that bad Oo
<RX14> probably not
<FromGitter> <bew> Yxhuvud did you bench in release mode?
<RX14> i'm pulling numbers from nowhere
<RX14> it's very unlikely to be that bad
<RX14> but
<Yxhuvud> bew: yes.
<RX14> its defiitely more expensive
mini_me44 has joined #crystal-lang
<Papierkorb> thought someone benched that in the PR, but can't remember
<Yxhuvud> for numbers, it is a few more instructions, but not that many.
<Yxhuvud> @bew: without optimization the difference is like 17 to 13s, or something like that.
<Yxhuvud> instead of 5 to 3.5
<FromGitter> <sdzyba> RX14 you mentioned once that if someone would hire you to work fulltime on Crystal you will accept that offer. ⏎ ⏎ 1) do you receive something from current monthly Crystal funding through bountysource? (sorry if that's too private question) ⏎ 2) if not, didn't you think about some similar kind of fundraising for you (and maybe other core team members) to work on Crystal?
<Yxhuvud> but of course, it is quite possible that it always will be faster to break it out (or to put everything in an array instead, it is only numbers up to 200 or so)
<RX14> @sdzyba 1) no 2) no
<RX14> well i guess i thought about it
<RX14> but I really can't be bothred
mini_me44 has quit [Quit: Page closed]
vivus has joined #crystal-lang
alex`` has quit [Quit: WeeChat 1.9.1]
baweaver is now known as lemur
lemur is now known as baweaver
Kug3lis has quit [Quit: Ping timeout (120 seconds)]
dtcristo has quit [Ping timeout: 240 seconds]
Kug3lis has joined #crystal-lang
dtcristo has joined #crystal-lang
dtcristo has joined #crystal-lang
mbarbar has joined #crystal-lang