ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.30.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
<FromGitter> <Blacksmoke16> is there an issue/thread about it somewhere?
<FromGitter> <watzon> Not that I can find. I remember having mentioned it a couple years back and the maintainers weren't interested. I can start a thread in the forum though.
<FromGitter> <Blacksmoke16> Probably not a bad idea
alex`` has quit [Ping timeout: 245 seconds]
<FromGitter> <Blacksmoke16> Any thoughts on that serialization prototype ^?
chemist69 has quit [Ping timeout: 264 seconds]
chemist69 has joined #crystal-lang
absolutejam1 has joined #crystal-lang
absolutejam1 has quit [Ping timeout: 268 seconds]
absolutejam1 has joined #crystal-lang
ht_ has joined #crystal-lang
absolutejam1 has quit [Ping timeout: 245 seconds]
ht_ has quit [Remote host closed the connection]
absolutejam1 has joined #crystal-lang
<FromGitter> <j8r> @Blacksmoke16 There are a lot more allocations than regular `JSON::Serialize` 2 Arrays and a Hash at least.
<FromGitter> <absolutejam_gitlab> Yeah, it would be super powerful if you could dive into the AST like in NIM
<FromGitter> <absolutejam_gitlab> crystal's macro system is definitely more approachable
<FromGitter> <absolutejam_gitlab> but limited
return0e has joined #crystal-lang
return0e_ has quit [Ping timeout: 258 seconds]
<FromGitter> <watzon> All I want is to be able to wrap classes, methods, etc and view/modify the AST
<FromGitter> <watzon> It would make the macro system so much more powerful
<FromGitter> <absolutejam_gitlab> yeah
<FromGitter> <absolutejam_gitlab> I like how NIM has both the way of escaping into the AST and raw AST node traversal/generation/manipulation
<FromGitter> <absolutejam_gitlab> Dunno why I keep capitilizing it
alex`` has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.5]
absolutejam1 has quit [Ping timeout: 245 seconds]
lawrence[m] is now known as ternarysolo
<FromGitter> <Blacksmoke16> @j8r could prob optimize some of that, maybe lazily initialize the hash only when some attributes are going to be set, ill get it more fleshed out then see what i can optimize
gangstacat has quit [Quit: Ĝis!]
gangstacat has joined #crystal-lang
absolutejam1 has joined #crystal-lang
<FromGitter> <kniknoo> Is there any sort of working group for upgrading the crystal book? Brian mentioned it on the forum and that's where I'd like to start getting a feel for a collab project, but it would be silly for me as a green dev to just start throwing out pull requests.
<FromGitter> <tenebrousedge> why silly?
absolutejam1 has quit [Ping timeout: 245 seconds]
<FromGitter> <kniknoo> You know that there is still a lot I take for granted. On one side it's valuable that I'm naive about things that might be assumed, but I feel like I'd still be... so naive about pulling as to be a nuisance.
<FromGitter> <tenebrousedge> documentation should be written *for* novices, and I would think that being written by a novice would help with that. Worst thing is you write something wrong
<FromGitter> <kniknoo> Ok, I guess I have some anxiety about first contributions. :) I appreciate that you feel the same.
absolutejam1 has joined #crystal-lang
<FromGitter> <tenebrousedge> @kniknoo did you ever tackle that Forth problem?
<FromGitter> <kniknoo> I haven't yet. I've been spreading myself so thin on exercism, I decided to start plowing through the ruby track to completion. I just jumped up by 10% alone yesterday, so I should be back to finishing up crystal soon. I can't wait for that one, it covers some things I was wondering about already.
<FromGitter> <kniknoo> One tidbit I've picked up along the way is that I'd like to try to set up a tutorial for us that mimics a lot of kotlin's starting ideas. Their presentation is great, though our playground is cooler. (Who wrote crystal play, it's amazing!!!)
<FromGitter> <kniknoo> And btw, grats all on multithreading, I've been sidetracked but can't wait to try it out!
<FromGitter> <tenebrousedge> What's kotlin's tutorial like?
absolutejam1 has quit [Ping timeout: 268 seconds]
<FromGitter> <kniknoo> It's a 4 section playground. ⏎ 1 is a playground. ⏎ 2 builds small practical projects using all the possible targets ⏎ 3 is a tutorial on the basics with runnable inline example ⏎ 4 is the koans section, where they give you toy problems to get used to [https://gitter.im/crystal-lang/crystal?at=5d7103c4b3e2fc579359a3d9]
<FromGitter> <tenebrousedge> have you done the Ruby Koans?
<FromGitter> <kniknoo> I had "one for X..." on exercism submitted in a one-liner about an hour after running through basics and some of koans. It's a really valuable interactive tutorial. https://play.kotlinlang.org
<FromGitter> <kniknoo> Most of it. I got stuck when it got into metaprogramming, one of the last few, but now that I've read the book on your suggestion I'm gonna tie up that loose end too.
<FromGitter> <kniknoo> I enjoy rubymonk too, but the inline doesn't work on any of my browsers.
<FromGitter> <tenebrousedge> Oh, awesome. How did you enjoy the book?
<FromGitter> <kniknoo> It was great, I feel like I understand a lot better now. I'm going to go through and revise some of my submissions to DRY them up a bit. You know I'm a sucker for "the least I could type" :D
<FromGitter> <tenebrousedge> I suffer from the same problem
<FromGitter> <tenebrousedge> ```TABLE = ["%%%ds"] * 6 * ' | ' % ([-30]+[2]*6) + "\n"```
<FromGitter> <kniknoo> I've been building up some philosophical thoughts as I'm language jumping. It's fascinating how we're moving toward conciseness as a language goal.
<FromGitter> <tenebrousedge> are we? has Golang been told?
<FromGitter> <kniknoo> :D I can't resist a clever trick. I'm glad that ternaries are starting to be more welcome these days in the languages I like.
<FromGitter> <kniknoo> I haven't actually checked go yet... noted. Kotlin, Scala, even Swift a bit caught my eye as a style I like.
<FromGitter> <kniknoo> I feel like we're at a point where the clever merging of OOP and Functional should have its own designation as separate from either parent.
<FromGitter> <tenebrousedge> Hmm. Picked up any Elixir yet?
<FromGitter> <kniknoo> It's on the list. Erlang went over my head for the most part. My friend is trying to beat clojure into my brain so that'll likely be my gateway to purer functional thinking.
<FromGitter> <tenebrousedge> these are your father's parentheses (https://xkcd.com/297/)
<FromGitter> <kniknoo> Although kotlin will be my gateway to embracing the java way. It's so foreign to me.
<FromGitter> <tenebrousedge> I have no interest in Java :(
<FromGitter> <kniknoo> OMG lulz. It's been a couple weeks of us arguing why our language is awesome for us to build the mutual respect.
<FromGitter> <kniknoo> Not java no, but kotlin is a key for me to make some apps without thinking TOO much about the java ecosystem.
<FromGitter> <kniknoo> Like not thinking about C in crystal. You can get away with it for little things, but it' all there.
<FromGitter> <tenebrousedge> there's not that much C in crystal, particularly as compared to Ruby
<FromGitter> <kniknoo> Right, but in much the same way, kotlin is pretty well abstracted away from its parent, aside from pulling in some of the primitives. Eh, I may stil be too green to explain what it is I'm trying to say. More lineage than application.
<FromGitter> <kniknoo> ...LLVM always becomes C at some point, yeah? Maybe I'm misunderstanding that.
<FromGitter> <tenebrousedge> you look more white-and-red than green to me
<FromGitter> <kniknoo> I'm very much the purple, red, black, and silver type, but...
<FromGitter> <tenebrousedge> LLVM does not become C, it goes Crystal -> LLVM IR -> machine code
<FromGitter> <kniknoo> Ok, gotcha. The compiler world is still very new to me, I have a lot to learn about the old ways for the value of the new to make sense. I've been doing a lot of computer history and my Clojure friend has the Dragon book on the way for me.
<FromGitter> <kniknoo> When I get a downloadable Crystal compiler target for the RasPis up, I'll feel achieved.
<FromGitter> <kniknoo> Am I right in understanding that with some work I could be programming ATMELs with crystal? Or should I look to the mRuby project?
<FromGitter> <tenebrousedge> I'm afraid I don't know anything about those
<FromGitter> <kniknoo> All good, I'm as far as noting that LLVM has an ATMEL target, I'll need to try it without the Arduino training wheels with something else, but a kushy microcontroller language would be awesome.
DTZUZO has quit [Quit: WeeChat 2.0]
DTZUZO has joined #crystal-lang
<FromGitter> <tenebrousedge> definitely
<FromGitter> <tenebrousedge> I think I'm going to have to write some mentor notes for the Ruby Tournament problem
<FromGitter> <tenebrousedge> I don't trust anyone else to find the "right" solution
<FromGitter> <kniknoo> I haven't seen it yet, that's the finale, yeah?
<FromGitter> <tenebrousedge> um...maybe?
<FromGitter> <tenebrousedge> I think it's an optional one
<FromGitter> <tenebrousedge> no, you're right
<FromGitter> <tenebrousedge> I had thought there were notes for all the core exercises
<FromGitter> <kniknoo> I haven't seen it from that side yet, but I'll join you on mentoring once I'm through. I've been catching a few errors on some tests in other languages that make things needlessly difficult on easy.
<FromGitter> <kniknoo> I can't even start lua because the first test uses a require syntax that I question the validity of. I don't know how to report that kind of stuff.
<FromGitter> <tenebrousedge> Maybe submit an issue here (https://github.com/exercism/lua)
<FromGitter> <kniknoo> Oh! ok. derp.
DTZUZO has quit [Quit: WeeChat 2.0]
<FromGitter> <mavu> https://play.crystal-lang.org/#/r/7i21 ⏎ why does this give me a execution timed out, without any output, shouldn't the second spawn block oputput something while the first waits for input?
<FromGitter> <Blacksmoke16> right but its a playground, try it locally
<FromGitter> <Blacksmoke16> i.e. you cant give it input so it eventually times out
DTZUZO has joined #crystal-lang
<FromGitter> <mavu> ok, that does output things. which is annoying, because I am trying to replicate a problem I have with reading /dev/ttyUSB0 where a spawned fibre just seems to stop the whole execution
<FromGitter> <watzon> @mavu if you need to test in a playground you can always use the local one
<FromGitter> <watzon> `crystal play`
<FromGitter> <mavu> Could someone point me to an example of a file.read that has to wait for something to read?
<FromGitter> <watzon> What is it waiting for?
<FromGitter> <mavu> I'm reading from /dev/ttyUSB0 which is a file that sometimes has no more content but is not closed.
<FromGitter> <mavu> Its a USB serial device
<FromGitter> <mavu> and I have to wait for the other side tosend something on the wire.
<FromGitter> <mavu> but I can't think of a example of a file that behaves in the same way to test it without the serial-port requirement
<FromGitter> <watzon> You should be able to do `File.open` to create a IO stream, and then you can do stuff like check if it's empty, read it, rewind the IO and read it again, etc
<FromGitter> <mavu> I don't think thats the same, because a normal file always has a EOF
<FromGitter> <watzon> Hmm true, I'm trying to open `dev/tty` locally and it just keeps going
<FromGitter> <mavu> I need a file without a end that I can read from and make my example wait until something is available to read again.
<FromGitter> <mavu> maybe if I read from stdin?
<FromGitter> <mavu> how do I read from STDIN ?
<FromGitter> <mavu> can't find it in the api doc
<FromGitter> <j8r> yes, STDIN you can
<FromGitter> <watzon> Well `STDIN` is a constant in Crystal that returns a `IO::FileDescriptor`
alex`` has joined #crystal-lang
hightower3 has joined #crystal-lang
<FromGitter> <mavu> ```mkfifo piope``` ⏎ ⏎ you can put stuff into the pipe from a different terminal with for example ⏎ cat > piope ⏎ and if you use cat piope to read the pipe, it works as expected. But above Crystal program just does nothin. [https://gitter.im/crystal-lang/crystal?at=5d712d93767de913fc88d054]
<FromGitter> <mavu> it hangs on the f.gets
<hightower3> mavu: if you remove all code from your program except the two lines (one which opens file and one which prints result of f.gets) you will see that it works
<hightower3> so the issue is in your code, not f.gets
<FromGitter> <asterite> it works fine in Ruby, though. Might be a problem with Crystal
<FromGitter> <mavu> Alright, thats a start :)
<FromGitter> <mavu> It might be a rare case that just never came up in file handling. This sort of wait to read situation usually only happens on sockets/netword
<FromGitter> <asterite> it seems the LibC.read call blocks forever for some reason
<FromGitter> <asterite> Might be worth reporting it as a bug for someone to investigate
<FromGitter> <asterite> The good news is that this seems to work fine with the new multithreading stuff because the other spawn might run in a separate thread
<FromGitter> <mavu> @asterite that is a nice positive sideeffect.
<FromGitter> <mavu> I'll report it as a bug, I'll just include everything I wrote above, or should I add anything ?
<hightower3> mavu: I am unable to reproduce what you are saying
<hightower3> I ran your program
<hightower3> and after "f.gets" I put "p :yes"
<hightower3> and every time I cat into the pipe, it reads the line and afterwards prints :yes
<hightower3> am I completely misunderstanding your report?
<FromGitter> <mavu> let me try
<FromGitter> <asterite> what os are you all in?
<hightower3> linux here
<FromGitter> <asterite> mac here
<FromGitter> <mavu> linux
<FromGitter> <mavu> (debian)
<FromGitter> <asterite> hmmm.... thenI don
<FromGitter> <asterite> then I don't know
<FromGitter> <asterite> but I was able to reproduce it, it hangs and doesn't execute the other fiber
<FromGitter> <mavu> if I add p :yes it also hangs.
<FromGitter> <mavu> weird.
<hightower3> ah wait, yeah I was focused on the part of the report which said that 'gets' hanged, which it didn't since it does read lines
<hightower3> but you are right that the other fiber is not executing
<FromGitter> <mavu> Right, I could have been more clear. but thats what I meant.
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 245 seconds]
<FromGitter> <mavu> made a bug report https://github.com/crystal-lang/crystal/issues/8152
<FromGitter> <mavu> I hope that's ok and not missing anything important.
absolutejam1 has joined #crystal-lang
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
<hightower3> Too bad Programming Crystal book does not touch generic types and that other advanced thing... can't recall the name right now
<FromGitter> <kinxer> Macros?
<FromGitter> <absolutejam_gitlab> made the massive mistake of trying to run `yarn install` on a train
<FromGitter> <absolutejam_gitlab> this will take forever
<FromGitter> <Blacksmoke16> f
<FromGitter> <absolutejam_gitlab> should not have deleted those node modules..
<FromGitter> <absolutejam_gitlab> I wish `crystal tool format` was customisable
<FromGitter> <Blacksmoke16> not a fan of one of the styles?
<FromGitter> <absolutejam_gitlab> change the indent size, don't reformat my stuff that's been aligned
<FromGitter> <Blacksmoke16> :0 are you one of those 4 space heathens? :D
<FromGitter> <absolutejam_gitlab> After using golang I quite like larger indents
<FromGitter> <Daniel-Worrall> Hm, how can I get a variable from a String of variable name
<FromGitter> <absolutejam_gitlab> It forces me to split things out a bit more
<FromGitter> <Blacksmoke16> @Daniel-Worrall example?
<FromGitter> <Blacksmoke16> split them out how?
<FromGitter> <absolutejam_gitlab> just a mental lightbulb that says 'bro, you're indenting too far - split it'
<FromGitter> <absolutejam_gitlab> I try to split into smaller functions anyway
<FromGitter> <Blacksmoke16> ah fair enough
<FromGitter> <absolutejam_gitlab> and I feel like it would be a bit more readable with the nested blocks
<FromGitter> <absolutejam_gitlab> also, I don't like `case` and `when` being aligned
<FromGitter> <absolutejam_gitlab> maybe I am a formatting heathen
<FromGitter> <Blacksmoke16> xD
<FromGitter> <Blacksmoke16> i rather like there being a common style spec between all shards
<FromGitter> <Blacksmoke16> saves having to argue semantics of how to style something and stuff
<FromGitter> <j8r> the problem is the formatter can't be easily forked
<FromGitter> <absolutejam_gitlab> I guess
<FromGitter> <Daniel-Worrall> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d715d58c5939027201b72c9]
<FromGitter> <Daniel-Worrall> like this
<FromGitter> <j8r> i'm for splitting projects in different repos, core members not
<FromGitter> <Daniel-Worrall> that makes more sense than what I actually typed
<FromGitter> <absolutejam_gitlab> Yeah I agree about splitting parts out
<FromGitter> <Blacksmoke16> you would have to use a case generated using macros
<FromGitter> <Daniel-Worrall> hmm
<FromGitter> <Blacksmoke16> whats the use case?
<FromGitter> <j8r> We end up having JS/HTML/CSS stuff inside a compiler :/
<FromGitter> <absolutejam_gitlab> You can't use a property that's a hash?
<FromGitter> <Daniel-Worrall> Use case: Instance variables of handlers. Be able to delete handler using only 1 method instead of the 10 different event types.
<FromGitter> <Daniel-Worrall> So it'd call `@event_handler_for_foo.delete(bar)`
<FromGitter> <Blacksmoke16> :thinking:
<FromGitter> <Daniel-Worrall> I'd probably have to do a case
<FromGitter> <Daniel-Worrall> I feel like a delete method for each event type would saturate it
<FromGitter> <Blacksmoke16> if you have to use a case is prob a better approach to the architecture of what you're doing
<FromGitter> <Daniel-Worrall> unless I use a hash for each array of procs
<FromGitter> <Daniel-Worrall> like `@all_handlers = { "event_type" => [] of -> }`
<FromGitter> <absolutejam_gitlab> oh god, that syntax is horrible
<FromGitter> <Daniel-Worrall> so then it's just a hash call to
<FromGitter> <Daniel-Worrall> I mean yeah, the syntax is pretty bad, but shortened for example
<FromGitter> <Blacksmoke16> i dont know enough about what you're trying to do but there is prob a better way
<FromGitter> <Daniel-Worrall> Probably
<FromGitter> <Daniel-Worrall> I'm implementing WebSub in a library scope
<FromGitter> <Daniel-Worrall> So users can add a handler for the callback
<FromGitter> <Blacksmoke16> have an example of it being used?
<FromGitter> <Daniel-Worrall> but also be able to remove later without restarting the whole program
<FromGitter> <j8r> and only have an array of procs?
<FromGitter> <Daniel-Worrall> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d715f08c5939027201b7fdb]
<FromGitter> <Blacksmoke16> and im assuming the set of events is static?
<FromGitter> <Daniel-Worrall> yup
<FromGitter> <Daniel-Worrall> I already have macros to set up the methods and such
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <Daniel-Worrall> also ⏎ ⏎ ```handler = client.on_user_follow {} ⏎ client.delete_handler(handler)`````` [https://gitter.im/crystal-lang/crystal?at=5d715f9d50508949d3e1e033]
<FromGitter> <Daniel-Worrall> that's the kind of syntax I was thinking
<FromGitter> <Daniel-Worrall> I'm going to implement a hash instance variable for all handlers instead
<FromGitter> <Daniel-Worrall> although it will add a small overhead
<FromGitter> <Daniel-Worrall> hmm
<FromGitter> <Blacksmoke16> is there a need to group them by type?
<FromGitter> <Daniel-Worrall> type?
<FromGitter> <Blacksmoke16> like "on_user_follow"
<FromGitter> <Blacksmoke16> as im assuming that would be the key and value would be array of handlers of that type/
<FromGitter> <Daniel-Worrall> each endpoint has its own payload type, yeah
<FromGitter> <Daniel-Worrall> different json mappings
<FromGitter> <Daniel-Worrall> Okay, I'm going to do the case statement then
<FromGitter> <Blacksmoke16> yea i dont know enough about this to have any suggestions atm
<FromGitter> <Blacksmoke16> er only thought i have atm is like what if
<FromGitter> <Blacksmoke16> each handler was its own object, so would do like `OnUserFollow.create { # do stuff }`
<FromGitter> <Blacksmoke16> then could be stored in a single array and do like `@handlers.select(OnUserFollow).each &.call`
<FromGitter> <Blacksmoke16> and array delete would work as well i think
<FromGitter> <Blacksmoke16> idk how performant that would be vs a hash or your case statement tho
<FromGitter> <Daniel-Worrall> Eh, I'm already doing a class for each Payload type
<FromGitter> <Daniel-Worrall> type for each Handler seems excessive
<FromGitter> <Blacksmoke16> fair enough
alex`` has quit [Ping timeout: 245 seconds]
alex`` has joined #crystal-lang
<FromGitter> <kniknoo> > also, I don't like `case` and `when` being aligned ⏎ LOL, crystal is why I'm a fan of it. It forces me to be concise, Kai called me out for that in Ruby.
<FromGitter> <absolutejam_gitlab> a fan of them being aligned?
<FromGitter> <Blacksmoke16> i dont really care enough
<FromGitter> <absolutejam_gitlab> I'd rather have ⏎ ⏎ ```case ⏎ when Foo then ... ⏎ when Bar ⏎ ... ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5d7164bf32e48c5df24351a9]
<FromGitter> <kniknoo> Very much. I like my line count minimal.
<FromGitter> <absolutejam_gitlab> its how I'd write it in Elixir
<FromGitter> <absolutejam_gitlab> it's the same line count
<FromGitter> <Daniel-Worrall> if you don't want your case and whens to be aligned, just build it with a macro :^)
<FromGitter> <kniknoo> Oh geez, I'm thinking when/then , but I don't *mind* the case/when, though i forget.
<FromGitter> <kniknoo> I do wish it were a touch more like rubocop though, customizable and informative about style preferences.
<FromGitter> <kniknoo> ...if I had one style blessing it would be for one-liner defs when they fit under 80.
<FromGitter> <absolutejam_gitlab> as @Blacksmoke16 demonstrated before, you can `def foo; end`
<FromGitter> <absolutejam_gitlab> and it won't get reformatted
<FromGitter> <absolutejam_gitlab> would be nice if you didn't need the `;`
<FromGitter> <Blacksmoke16> is also https://github.com/crystal-ameba/ameba @kniknoo if you havent seen it yet
<FromGitter> <kniknoo> Oh, I reckon I missed the `;` then. NOTED!
<FromGitter> <kniknoo> OMG, thank you, I'll give ameba a go!
<FromGitter> <Blacksmoke16> np
<FromGitter> <SewerynKaminski> hey, do you know why string interpolation are "#{xxx}" why not "{xxx}"? Is # needed? Why?
<FromGitter> <Blacksmoke16> is just how it works
<FromGitter> <Blacksmoke16> ruby does the same prob prob because of that?
<ternarysolo> I assume it is because that is how Ruby does it.
absolutejam1 has quit [Ping timeout: 268 seconds]
<FromGitter> <dansimpson> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d716f9ac5939027201bf65e]
<FromGitter> <Blacksmoke16> iirc you dont have, or have invalid typing on a block
<FromGitter> <dansimpson> ok, so I just need to search it out
<FromGitter> <dansimpson> the compile with trace doesn't want to show it
<FromGitter> <Blacksmoke16> is this within your project or a lib?
<FromGitter> <dansimpson> yeah
<FromGitter> <Blacksmoke16> ...
<FromGitter> <Blacksmoke16> which one?
<FromGitter> <dansimpson> It's something I wrote for our company, small utility
<FromGitter> <dansimpson> I
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <dansimpson> Well, actually, it's pretty clear now that I remember I have something called ResultSet , lol, sorry
<FromGitter> <asterite> Yeah, I really need to improve that error message
<FromGitter> <dansimpson> ``` def each ⏎ named.each do |k, v| ⏎ yield k, v ⏎ end ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5d7170e3be4a3f13fdf3876a]
<FromGitter> <dansimpson> that is the problem I think
<FromGitter> <tenebrousedge> shouldn't be anything wrong with that as long as `named.each` is defined
<FromGitter> <dansimpson> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d71718cb9abfa4bd357c952]
<FromGitter> <dansimpson> if I remove the Enumerable include, it seems to work
<FromGitter> <dansimpson> Man, I must be tired, I didn't write this code.
<FromGitter> <Daniel-Worrall> each needs to be defined with a block
<FromGitter> <dansimpson> Thanks for helping me through this, sorry for the distraction. It looks like it was solved here: https://github.com/mosop/callback/pull/3/files
<FromGitter> <dansimpson> Crystal has been really nice to work with.
ht_ has joined #crystal-lang
<FromGitter> <Blacksmoke16> np, good to hear ;)
<FromGitter> <kniknoo> I have a potential example together, just a toy that generates random words, finds the palindromes, and lists them. Also shows a class, monkey patching, getter macro, colorize, and String.build . Do you think it would be wise is we changed the style from the example pages so that they use correct commenting inline in order to subliminally get the layout familiar?
<FromGitter> <Blacksmoke16> hm?
<FromGitter> <watzon> @SewerynKaminski `{var_name}` is used with format strings
<FromGitter> <watzon> `"Hello {place}" % {place: "world"}`
<FromGitter> <Blacksmoke16> TIL thats a thing
<FromGitter> <kniknoo> Well, neither example in the git book is highly applicable because there are no classes or defs, but instead of explaining what's happening afterward: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ as per documentation convention. [https://gitter.im/crystal-lang/crystal?at=5d7176fcbe4a3f13fdf3ac28]
<FromGitter> <Blacksmoke16> whats the benefit of that vs `#{var}`?
<FromGitter> <kniknoo> I've never cared for the "fprint" interpolation style like that.
<FromGitter> <watzon> Can't think of one off the top of my head
<FromGitter> <Blacksmoke16> remove it ! :P
<FromGitter> <Blacksmoke16> :trollface:
<FromGitter> <tenebrousedge> fprint is sometimes useful
<FromGitter> <watzon> Actually I know
<FromGitter> <watzon> There's other things you can do there that you can't with basic interpolation
<FromGitter> <watzon> Like adding padding and formatting
<FromGitter> <tenebrousedge> yes
<FromGitter> <Blacksmoke16> i suppose
<FromGitter> <asterite> it's good for internalization, where if you have multiple things to interpolate they might go in a different order
<FromGitter> <watzon> That too
<FromGitter> <asterite> "The {adjective} {noun}" % {adjective: "white", noun: "house"} ⏎ "La {noun} {adjective}" % {adjective: "blanca", noun: "casa"}
<FromGitter> <kniknoo> Indeed, I'm not gonna pull a Generics are useless or anything.
<FromGitter> <watzon> You can also store a string like that and then use it later with multiple different values
<FromGitter> <kniknoo> Nice!
<FromGitter> <Blacksmoke16> good example
<FromGitter> <Blacksmoke16> does it just use gsub under the hood?
<FromGitter> <kniknoo> It's nice there, I guess it's just the Python way that rubs me wrong.
<FromGitter> <watzon> I don't think so
<FromGitter> <watzon> I mean it's the ruby way too haha
<FromGitter> <watzon> But y
<FromGitter> <Blacksmoke16> i could prob use that in assert
<FromGitter> <watzon> I've used t
<FromGitter> <kniknoo> I'm just not familiar enough with the ruby syntax of it yet, it just makes me think of python when I see it.
<FromGitter> <Blacksmoke16> then the templates could just be like `{ivar_name}`
<FromGitter> <watzon> Yeah probably haha
<FromGitter> <Blacksmoke16> and build out the NT
<FromGitter> <asterite> you can also specify formatting, like %.2f and so on
<FromGitter> <asterite> so it's printf
<FromGitter> <asterite> it's actually aliased to `sprintf`
<FromGitter> <kniknoo> Good to know.
<FromGitter> <Blacksmoke16> yea good call, i might update that
<FromGitter> <Blacksmoke16> i will*
<FromGitter> <asterite> we copied `str % values` from Ruby, maybe it's ugly and we should remove it
<FromGitter> <Blacksmoke16> oh rip thats what i was going to use :S
<FromGitter> <Blacksmoke16> oh i can just use sprintf directly, nvm
<hightower3> Hey, did any progress begin to support crystal on ppc64le?
<FromGitter> <Blacksmoke16> well no, because they would have to be in the correct order
<FromGitter> <watzon> It's nice that it also works with positional arguments, so you can do `"Hello {}" % place` as well
<FromGitter> <Blacksmoke16> nvm again, there is an overload that uses `*args`
<FromGitter> <kniknoo> Yeah, that's neat, seems like a nice bit of sugar really.
<FromGitter> <tenebrousedge> @asterite please don't remove it :(
<FromGitter> <watzon> Yeah it definitely shouldn't be removed
<FromGitter> <asterite> ok, I won't :-)
<FromGitter> <watzon> It's very useful
<FromGitter> <watzon> https://carc.in/#/r/7i65
<FromGitter> <watzon> This is a nice feature
<FromGitter> <Blacksmoke16> how would that work with named args?
<FromGitter> <Blacksmoke16> https://carc.in/#/r/7i6c/edit
<FromGitter> <kniknoo> Indeed, when making an assembler that was very helpful.
<FromGitter> <watzon> I can't remember how to do it with named args
<FromGitter> <watzon> I'm fairly certain it's possible
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/toplevel.html#sprintf(format_string,args:Array|Tuple):String-class-method doesnt even mention named arg syntax 😢
<FromGitter> <watzon> https://carc.in/#/r/7i6l
<FromGitter> <watzon> There we go
<FromGitter> <watzon> Tbh this is the best reference https://ruby-doc.org/core-2.6.4/Kernel.html#method-i-sprintf
<FromGitter> <watzon> Crystal's docs need to be updated
<FromGitter> <Blacksmoke16> ```code paste, see link```
ht_ has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> gotcha so `<>` allows for it and `{}` doesnt
<FromGitter> <watzon> Yeah it's interesting
<FromGitter> <Blacksmoke16> yea that'll be much better than my gsub ha
<FromGitter> <Blacksmoke16> good stuff
<FromGitter> <watzon> It's also nice if you want to convert a number to binary or hex and pad it
<FromGitter> <watzon> `num.to_s(16)` doesn't allow that
<FromGitter> <watzon> You'd have to do `num.to_s(16).rjust(8, '0')` or somthing
<FromGitter> <watzon> https://carc.in/#/r/7i6n
<FromGitter> <Blacksmoke16> neat
<FromGitter> <watzon> Interesting, it looks like the `#` doesn't do anything in Crystal
<FromGitter> <Blacksmoke16> hm?
<FromGitter> <kniknoo> That's Nice! ok, While I'm on the mindset of building crystal examples with some density of features, I'll do a simple mock assembler to show padding.
<FromGitter> <kniknoo> The `#` in `#{}` is optional?
<FromGitter> <Blacksmoke16> no
<FromGitter> <watzon> In Ruby's sprintf the `#` will add a `0x` before a hex number
<FromGitter> <kniknoo> Oh, ok
<FromGitter> <watzon> So `puts "%#08X" % num` should be `0x00000045`
<FromGitter> <watzon> Same with binary and octal, but with `0b` and `0o` respectively
<FromGitter> <kniknoo> This was my entire pointer handler in my assembler: `sprintf "%016b", cmd.lchop("@").to_i16`
<FromGitter> <bararchy> Did anyone testing Master with `-Dpreview_mt` got: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d717f5c11f374371a0d6c8e]
<FromGitter> <asterite> I think you need a newer version of libgc
<FromGitter> <bararchy> @asterite did you see that? Maybe I got a wrong libgc lib?
absolutejam1 has joined #crystal-lang
<FromGitter> <watzon> @Blacksmoke16 does CrSerializer have any kind of transformers yet? Like Crystal's converters?
<FromGitter> <Blacksmoke16> hm?
<FromGitter> <Blacksmoke16> like changing how a property gets serialized?
<FromGitter> <watzon> Yessir
<FromGitter> <Blacksmoke16> kinda yea
<FromGitter> <Blacksmoke16> sec
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d718f90a08e2b4bd2948ee6]
<FromGitter> <Blacksmoke16> can use a method vs like `@name`
<FromGitter> <asterite> @bararchy all I know is that those functions were added by Brian recently: https://github.com/ivmai/bdwgc/pull/277 . So you must have an older gc version somehow
DeBot has quit [Quit: Crystal IRC]
asterite has quit [Quit: Bye]
jhass has quit [Quit: Bye]
asterite has joined #crystal-lang
DeBot has joined #crystal-lang
jhass has joined #crystal-lang
<FromGitter> <jwoertink> Can anyone see what I'm missing here with this error?
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d719423c38d634123a285aa]
<FromGitter> <jwoertink> The code throwing this `Concurrent::Future.new { fetch_network_latest }` where the block returns my `Array(DiscJockey::Burns::Decorator)`
<FromGitter> <Blacksmoke16> What happens if you assign it within the method
<FromGitter> <jwoertink> what do you mean?
<FromGitter> <jwoertink> Or maybe there's a better way to do this
<FromGitter> <jwoertink> I have to make 4 really large queries for my page to load
<FromGitter> <jwoertink> I'd like to have them all go async, and then have the page load when they're all done
<FromGitter> <Blacksmoke16> i mean like ⏎ ⏎ ```def initialize(run_immediately = true, delay = 0.0, &block : -> R) ⏎ @block = block``` [https://gitter.im/crystal-lang/crystal?at=5d719558460a6f5a16d16fcf]
<FromGitter> <Blacksmoke16> i mean like ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d71955f2f93ab5a15112c39]
<FromGitter> <jwoertink> that initialize code is in crystal
<FromGitter> <jwoertink> that's not my code
<FromGitter> <Blacksmoke16> ah
<FromGitter> <jwoertink> my code is just `Concurrent::Future.new { fetch_network_latest }`
<FromGitter> <jwoertink> the part that throws me off in the error is
<FromGitter> <jwoertink> > must be Proc(Array(DiscJockey::Burns::Decorator)), not Proc(Array(DiscJockey::Burns::Decorator))
<FromGitter> <Blacksmoke16> yea strange
<FromGitter> <jwoertink> I don't see what the difference is
<FromGitter> <jwoertink> maybe it's just a bug in the language?
absolutejam1 has quit [Ping timeout: 268 seconds]
<FromGitter> <asterite> It's probably a bug. Do you inherit from that type somewhere?
<FromGitter> <asterite> I mean from Decorator
<FromGitter> <Blacksmoke16> is that what you were looking for @watzon ?
<FromGitter> <watzon> Yeah more or less
<FromGitter> <Blacksmoke16> cool, currently working on a refactor of it so im open to ideas if you had something else in mind