ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.21.1 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
gewo has joined #crystal-lang
<FromGitter> <picatz> @jwoertink Not sure if I'm missing something, but: Could you turn that tuple into an array; then zip that tuple with the other array? `Hash.zip(array, tup.to_a)`
<FromGitter> <jwoertink> oh snap!
<FromGitter> <jwoertink> yup
<FromGitter> <jwoertink> that works. :D
<FromGitter> <jwoertink> Thanks @picatz
<FromGitter> <picatz> Swaggggg biscuits :sparkles:
<FromGitter> <jwoertink> lol
<FromGitter> <picatz> No worries! Glad I could help 'ya out.
<wmoxam> Anyone working on/know of X11 bindings for Crystal?
InternetFriend has joined #crystal-lang
InternetFriend has quit [Ping timeout: 258 seconds]
<adam12> There was a shard that would generate code from SQL. Does anybody remember the shard name?
<FromGitter> <jwoertink> https://github.com/sdogruyol/tren
<FromGitter> <jwoertink> that one?
<adam12> Bingo. I just found it too
<adam12> thanks
<FromGitter> <icyleaf> Hi, i was trying convert ruby to crystal, and is any method in crystal to get local ip address
<FromGitter> <jwoertink> I don't think so. I saw some open issues about ip address stuff
<FromGitter> <icyleaf> ```Socket.getifaddrs```
<FromGitter> <picatz> @icyleaf I'm not sure of any way to do this without shelling out to `ifconfig` under the hood at the moment :(
<FromGitter> <icyleaf> thanks @picatz @jwoertink
InternetFriend has joined #crystal-lang
InternetFriend has quit [Ping timeout: 240 seconds]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Client Quit]
InternetFriend has joined #crystal-lang
InternetFriend has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
pduncan has quit [Ping timeout: 240 seconds]
olek_poz has joined #crystal-lang
InternetFriend has joined #crystal-lang
InternetFriend has quit [Ping timeout: 240 seconds]
mark_66 has joined #crystal-lang
<FromGitter> <sdogruyol> @bararchy i did, check this thread https://twitter.com/sdogruyol/status/833369972919382019
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
unshadow has joined #crystal-lang
unshadow_ has joined #crystal-lang
unshadow_ has quit [Client Quit]
unshadow_ has joined #crystal-lang
unshadow has quit [Disconnected by services]
unshadow_ has quit [Client Quit]
unshadow has joined #crystal-lang
Qchmqs has joined #crystal-lang
Qchmqs has quit [Quit: Konversation terminated!]
Qchmqs has joined #crystal-lang
unshadow has quit [Quit: leaving]
Qchmqs has quit [Ping timeout: 256 seconds]
greengriminal has joined #crystal-lang
InternetFriend has joined #crystal-lang
InternetFriend has quit [Ping timeout: 260 seconds]
greengriminal has quit [Read error: Connection reset by peer]
bjz has joined #crystal-lang
greengriminal has joined #crystal-lang
greengriminal has quit [Read error: Connection reset by peer]
greengriminal has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 268 seconds]
mark_66 has quit [Read error: Connection reset by peer]
mark_66 has joined #crystal-lang
<RX14> If there an actual maintained version of https://github.com/phoffer/crystalized_ruby ?
<RX14> I'm sure there was but that might just be me.
McSoFake has joined #crystal-lang
Raimondi has quit [Quit: WeeChat 1.6-dev]
olek_poz has quit [Ping timeout: 260 seconds]
<RX14> looks like they're all broken :(
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
InternetFriend has joined #crystal-lang
sz0 has joined #crystal-lang
rkeene_ has joined #crystal-lang
rkeene has quit [Ping timeout: 255 seconds]
kellabyte_ has joined #crystal-lang
kellabyte has quit [Ping timeout: 255 seconds]
kellabyte_ is now known as kellabyte
poikon has quit [Ping timeout: 255 seconds]
kodo[m] has quit [Ping timeout: 255 seconds]
kodo[m] has joined #crystal-lang
poikon has joined #crystal-lang
mark_661 has joined #crystal-lang
mark_66 has quit [Read error: Connection reset by peer]
<FromGitter> <schoening> Is cru
<FromGitter> <schoening> Ups..
<FromGitter> <schoening> Thx phone.
<FromGitter> <schoening> Is crystals parallelism gonna allow for read access across "threads" ?
<RX14> yes
<RX14> we won't get rid of shared memory between fibers
<RX14> just like go
<FromGitter> <phoffer> RX14 Hi it’s in hibernation, if there is interest I’ll start working on it again
<RX14> @phoffer I'm seeing interest, but I was almost positive I saw an up-to-date shard...
<RX14> Maybe i'm dreaming
<FromGitter> <phoffer> I’ll look into whether there are regressions with the latest version of Crystal and update if I need
<RX14> i'm sure there will be a breaking change after almost a year LOL
<RX14> crystal just works that way...
<FromGitter> <phoffer> Haha yeah but there’s honestly not a whole lot of code to make it work. It’s mostly just the trial and error of getting it working in the first place, and having some organization to it
<FromGitter> <phoffer> Oh yikes if Piotr is interested then :) :) I’m a big fan of his work
mark_661 has quit [Remote host closed the connection]
<FromGitter> <phoffer> But I think the use case he explained would be a good one to experiment with, the overhead for going to Crystal and back is pretty low for primitive types
Raimondi has joined #crystal-lang
McSoFake has quit [Quit: No reason]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vSaUQ
<crystal-gh> crystal/master 32e4dd5 Ary Borenszweig: Make ssl sockets buffered. Fixes #4248
greengriminal has quit [Quit: This computer has gone to sleep]
DavidAlexander[m has joined #crystal-lang
go|dfish has quit [Ping timeout: 240 seconds]
<FromGitter> <solnic> @RX14 :wave:
<RX14> @solnic hi!
<FromGitter> <solnic> @phoffer thanks for the kind words :)
<FromGitter> <jwoertink> If I have a YAML file with an array of hashes in it where each hash matches with a YAML mapping, is there a way to do something like Blah.from_yaml, and retun an array of Blah?
<FromGitter> <jwoertink> or do I just have to YAML.parse, then map each hash back to_yaml, then Blah.from_yaml on those individually?
rkeene_ is now known as rkeene
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <jwoertink> ```struct Sample ⏎ DATA = {% YAML.parse(File.read("data.yml")) %} ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=58e6735e08c00c092a5543e7]
<FromGitter> <jwoertink> `undefined macro method 'TypeNode#read'`
<FromGitter> <jwoertink> Is doing this not a good idea?
<FromGitter> <jwoertink> or, is there another way of doing this? I figured it would be better to just read and parse the yaml file once instead of doing it each time I instantiate the struct
<FromGitter> <jwoertink> or maybe this is just a bug
<FromGitter> <jwoertink> I guess I can do it without the macro. I'm not really sure if there's any gain either way
<BlaXpirit> jwoertink, you cannot execute arbitrary Crystal code in macro language, it's an entirely different language
<BlaXpirit> (which is a shame)
<FromGitter> <jwoertink> ah, ok.
<FromGitter> <jwoertink> thanks
<BlaXpirit> jwoertink, you could do like https://crystal-lang.org/api/0.21.1/Crystal/Macros.html#run%28filename%2C%2Aargs%29%3AMacroId-instance-method but it's usually not worth it
<FromGitter> <jwoertink> lol
<FromGitter> <jwoertink> That's cool though that you can do that
<FromGitter> <elorest> @jwoertink You can compile and execute a crystal file within a macro and return from it. This is really useful for returning or building code dynamically within a macro.
<FromGitter> <jwoertink> Awesome
<FromGitter> <elorest> I usually take that approach. Similar to that link above.
<FromGitter> <jwoertink> Any suggestions for my previous question about the array in a yaml file?
<FromGitter> <jwoertink> if I have a yaml mapping like `YAML.mapping(name: {type: String})`, and an array like `- name: A\n- name: B`. Is there any handy methods like doing `SomeClass.from_yaml` but where it returns an array of SomeClass?
<FromGitter> <jwoertink> right now I parse the yaml, then map each hash in the array back to yml then call the from_yaml
<FromGitter> <elorest> Sorry I’m in a call but I have a solution.
<FromGitter> <jwoertink> no worries
go|dfish has joined #crystal-lang
greengriminal has joined #crystal-lang
InternetFriend has quit [Ping timeout: 240 seconds]
<FromGitter> <elorest> @jwoertink Solutioned! https://gist.github.com/elorest/f46938a0548eb286b9d796b89a36f5e5
<FromGitter> <jwoertink> interesting.
<FromGitter> <jwoertink> Not quite what I'm looking for, but that gives me a few ideas to try!
<FromGitter> <jwoertink> thanks :D
<jhass> with json you can just Array(Something).from_json, try if it works with from_yaml too?
InternetFriend has joined #crystal-lang
<FromGitter> <jwoertink> nice!
<FromGitter> <jwoertink> Yup, that works exactly how I wanted it to
<FromGitter> <jwoertink> Thanks @jhass
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58e68011b52518ed4de769d1]
<FromGitter> <elorest> I guess I miss understood what you were trying to do.
<FromGitter> <jwoertink> no worries. I'm horrible at explaining things. They always make sense in my head, and then come out as gibberish
<jhass> otoh isn't programming all about deciphering the gibberish other people produce and then translating that into gibberish for machines? :P
<FromGitter> <jwoertink> lol
<FromGitter> <jwoertink> so true
gloscombe has joined #crystal-lang
olek_poz has joined #crystal-lang
gloscombe has quit [Ping timeout: 260 seconds]
<FromGitter> <bew> nice definition of programming !!, I'll keep it in my quote-book :)
greengriminal has quit [Read error: No route to host]
greengriminal has joined #crystal-lang
<FromGitter> <elorest> Copying errors into google and clicking on stackoverflow.
<jhass> good programmers know the accepted answer isn't always the best one for their usecase and scroll down!
<jhass> the industries mystery though: where do those stackoverflow people copy their answers from?
<FromGitter> <elorest> good programmers feel a little bit guilty about getting all of their answers from a site written in c#
<jhass> hehe
<Papierkorb> jhass: Don't! You're about to crash the matrix
<jhass> didn't know it's C#, always looked railsy to me
<FromGitter> <elorest> https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=what+is+stack+overflow+written+in
<FromGitter> <sdogruyol> lol
<FromGitter> <sdogruyol> yeah SO is a great example of C# done right
<FromGitter> <elorest> Yeah.
<FromGitter> <picatz> C# done right is a tough pill for me to swallow :P
<FromGitter> <sdogruyol> haha
<FromGitter> <picatz> ( though I totally understand, and pretty much agree )
<FromGitter> <sdogruyol> it's a good language
<FromGitter> <sdogruyol> and they have deep pockets :/
<FromGitter> <picatz> *Sounds subjective to meh.* :P
<BlaXpirit> what exactly is wrong with C# though?
<FromGitter> <sdogruyol> not much, just the community i guess
<BlaXpirit> i was against it for the longest time but it's actually pretty good
<FromGitter> <picatz> *HEATHENS*
<FromGitter> <sdogruyol> lol
<FromGitter> <sdogruyol> you can't den its' adoption
<FromGitter> <picatz> Communities drive the language for the most part tho ami right?
<FromGitter> <sdogruyol> deny*
<FromGitter> <sdogruyol> @picatz not if it's funded by big companies like google, msft e.g
<FromGitter> <sdogruyol> oh no need to mention java :D
<BlaXpirit> what's this msFT that i keep seeing
<FromGitter> <sdogruyol> they dont give a damn about the community
<FromGitter> <picatz> Well, those *are* the communities, right? Like, those companies are part of the community.
<BlaXpirit> oh what do you know, Microsoft Corporation NASDAQ: MSFT
<FromGitter> <sdogruyol> well, i dont count them as 'community'
<FromGitter> <sdogruyol> they are not organic and mostly acting with some market profit share bullshit
<FromGitter> <picatz> Fair enough. I sort'of do.
<FromGitter> <sdogruyol> it's ok
<FromGitter> <sdogruyol> :)
<FromGitter> <picatz> Without them, do you think there would be a community around C#?
<FromGitter> <picatz> Well, probably would be. I guess, I'm assuming, the community wouldn't be the same.
<FromGitter> <picatz> Which totally goes without saying. Because I like stating the obvious.
<FromGitter> <sdogruyol> well there's mono
<FromGitter> <sdogruyol> they did a fantastic job and now they're being the official linker stuff for .net core
<FromGitter> <sdogruyol> should have been from the start though but companies
<FromGitter> <picatz> TIL what mono is.
<FromGitter> <sdogruyol> :D
<FromGitter> <picatz> :+1: I appreciate you.
<jhass> BlaXpirit: lookup todays thedailywtf.com :D
<FromGitter> <sdogruyol> @picatz thank you
<FromGitter> <picatz> NONONOnonooonononon. no. thank. you. :clap:
<FromGitter> <picatz> :P
<FromGitter> <sdogruyol> what's that
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
<FromGitter> <jwoertink> Ok, so `YAML.mapping` creates an `initialize(pull : YAML::PullParser)`. Is there a way to access that `pull` object within that class?
<FromGitter> <jwoertink> It looks like that `pull` object responds to `to_json` and `from_json`, and I would like to delegate those methods to that object
<jhass> no, it's gone and stateful anyway
<jhass> where did you see its to/from_json methods anyway?
<jhass> it's probably just Object#to_json etc
<FromGitter> <jwoertink> well, I guess it's inheritied from Object
<FromGitter> <jwoertink> yeah
<jhass> those are of no use without a initialize(JSON::PullParser) / to_json(JSON::Builder) anyway ;)
<FromGitter> <jwoertink> I'll just switch from YAML.mapping to JSON.mapping.
<FromGitter> <jwoertink> Has anyone benchmarked those two to see which one has better parsing performance?
<jhass> I wouldn't be surprised if JSON is faster
<FromGitter> <picatz> Nope. But, I'd love to see one :+1:
<FromGitter> <jwoertink> I'm sure with small files it's probably not much different, but I'm thinking about if you're constantly loading in config files, or just really large files
<jhass> since it's simpler to parse than JSON and also from what I've heard libyaml isn't the fastest thing in the world either while Crystal's JSON parser is actually pretty good
<FromGitter> <jwoertink> so probably a benefit moving all these config files to json then ;)
<jhass> eh I don't think that'S anywhere near a size where it would matter
<FromGitter> <picatz> *Benchmarks. Benchmarks. Benchmarks.*
<jhass> uh, of course I meant since it's not simpler to parse than JSON
<jhass> do one, require "benchmark/ips" and go
<FromGitter> <jwoertink> I'll try it out just for fun and see what I get
<FromGitter> <picatz> Lemme know how it goes.
<FromGitter> <jwoertink> will do! I'm going to use actual data that I have for more of a real test
<FromGitter> <picatz> I'd assume, for a comprehensive test, you'd need to try a larger sampling of data.
<FromGitter> <picatz> I'm actually terribly curious to know when the "right" time to use YAML would be and the "right" time to use JSON. I guess, for speed in this case specifically. For your use case though, I definitely get jus using your current data though.
<FromGitter> <picatz> MABYE I'LL ATTEMPT TO EXPAND UPON YOUR WORK. '\( ' ~')/'
<FromGitter> <jwoertink> TIL: calling `to_json` on a rails model converts the enum. calling `to_yaml` doesn't
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58e69d318fcce56b20d8cc33]
<FromGitter> <jwoertink> ok, there's your answer
<FromGitter> <jwoertink> each file is a little over 4mb with 500 records each
<FromGitter> <jwoertink> about 50 mappings in each which are `String?` `Int32?` `Bool?` or `Time?`
<FromGitter> <jwoertink> oh, and one `Hash(String, String?)?`
<FromGitter> <picatz> Well.
<FromGitter> <picatz> I'mma just accept that as my answer.
<FromGitter> <jwoertink> I should also say that, this is how I benchmarked
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58e69df08e4b63533da2b203]
<FromGitter> <picatz> :+1: Very interesting.
<FromGitter> <picatz> I guess I didn't think yaml would be *that much* slower.
<FromGitter> <jwoertink> lol. I didn't either. I was thinking it would say like 2x slower or something
<FromGitter> <picatz> Pretty neat stuff.
<FromGitter> <picatz> Like, mind opening mannnnn.
<FromGitter> <picatz> *tiny splosions in ma brain homie*
<FromGitter> <jwoertink> lol
<FromGitter> <picatz> Today we learned just always use json.
<FromGitter> <picatz> *Because that's how this works. Def how this works.*
<jhass> uh, take the read out of the benchmark
<jhass> disk IO is anything but consistent :P
<FromGitter> <picatz> That's a good point.
<FromGitter> <picatz> *Don't argue with our science.*
<jhass> :P
<FromGitter> <jwoertink> ok, 1 sec
<jhass> nonetheless while it's that much slower I'd rather say json is that much faster ;) 200ms for 4M isn't too bad
<FromGitter> <jwoertink> ok, updated
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58e69f1a8fcce56b20d8d4ef]
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58e69f248bb56c2d11814a23]
<FromGitter> <picatz> THAT IS SOME SCIENCE.
<FromGitter> <picatz> TO ME
<jhass> hah you got some good disk cache there :D
<jhass> would've expected more overhead from the FD opening/closing alone
<FromGitter> <picatz> tbh I dunno how that stuff works
<FromGitter> <picatz> *hence* SCIENCE TO ME :D
bjz has joined #crystal-lang
<FromGitter> <drosehn> Is there an EDN formatter written for crystal yet?
<FromGitter> <clthck> is there rails-like framework written in crystal that is mature enough as rails?
<BlaXpirit> srsly?
<FromGitter> <fridgerator> mature as rails?
<FromGitter> <jwoertink> lol
<FromGitter> <jwoertink> I've been in development for 35 years and I'm still not "mature"
<FromGitter> <fridgerator> @clthck there are some frameworks, but the language isnt even as old as the rails framework, you can check here: http://awesome-crystal.com/#awesome-crystal-web-frameworks
<FromGitter> <fridgerator> Kemal being the most popular, but its more like sinatra
<FromGitter> <jwoertink> Do you guys rememebr when the New York public library posted that rails job that required 10+ years rails experience? And then DHH was like "I can't wait until I qualify for that job"
<FromGitter> <jwoertink> I think it was like back in 08 or 09
<FromGitter> <fridgerator> lol no
leonardschuetz has joined #crystal-lang
leonardschuetz is now known as KCreate
InternetFriend has quit [Ping timeout: 240 seconds]
<FromGitter> <KCreate> Am I the only one who has never done any rails development? Never tried it out, is it really that great?
KCreate has quit [Quit: leaving]
<FromGitter> <jwoertink> Out of all the frameworks I've worked with it's my favorite. It has it's issues like anything though.
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
<FromGitter> <clthck> what is the ETA for stable version of crystal?
<FromGitter> <jwoertink> Dec 31st
<FromGitter> <jwoertink> The best thing to help move that quicker though is to build projects with it
<FromGitter> <spalladino> @jwoertink hopefully we won't have to be working on new year's eve and will have a stable version ready earlier :P
<Papierkorb> KCreate, it's great for some. I like it, but I liked Roda+Sequel better. If you didn't yet, give it a try and build something simple
<FromGitter> <jwoertink> the more people doing that, the better chances we have of catching bugs
<FromGitter> <spalladino> We'll do our best to post regular updates though
<FromGitter> <jwoertink> hahah. C'mon, champagne and knocking out github issues sounds like an awesome way to ring in the new year :D
<Papierkorb> we'll give our best fireworks-reactions too!
<FromGitter> <jwoertink> if we get everyone hitting the balmer curve for just an hour, who knows what sort of stuff we could all come up with!
<FromGitter> <spalladino> True, running a `git tag` with 1.0 at 11:59 would be awesome
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <bew> Without cheating by manually setting the date-time of the commit used by the tag :D
<FromGitter> <fridgerator> Did someone say balmer peak? I'm always down
<FromGitter> <jwoertink> lol. yup!
olek_poz has quit [Ping timeout: 260 seconds]
<FromGitter> <drosehn> Historical note: "On Jan 2 2007, d-lang reached version 1.0. This release had two changes: (1) '-v' flag now outputs imports, and (2) added std.c.linux.pthread". So the official 1.0-release *could* be something minor, committed on the 31st! :smile:
<FromGitter> <drosehn> (and really, that's how it should be. If 1.0 includes massive changes, then it's almost certain that people will have to fear that there could be some issues with those changes)
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <elorest> 1) 0 should include 1% more specs and one minor bug fix.
bjz has joined #crystal-lang
<FromGitter> <fridgerator> 1% !?!?!
greengriminal has quit [Quit: Leaving]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
help has joined #crystal-lang
<help> hi
help is now known as Guest63844
<Guest63844> Crystal is really unique project
Guest63844 has quit [Client Quit]
bjz has joined #crystal-lang
<FromGitter> <drosehn> I find it quite useful in some circumstances, even though it is still undergoing changes. I would not start any huge project in it right now, but about once a month I try to tackle some smaller project.
<FromGitter> <drosehn> (I would do more with it if I wasn't so busy with too many unrelated projects)
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]