<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>
<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
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> 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
<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]
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
<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>
<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…]