RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.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> <mistergibson> Is anyone working on or planning a Crystal --> WebASM path?
<FromGitter> <mixflame> livepost is back up http://livepost.mixflame.com/
<FromGitter> <mixflame> powered by latest amber and crystal
<FromGitter> <mistergibson> thanks @Blacksmoke16 -- a lively discussion I've stepped into :/
<FromGitter> <dscottboggs_gitlab> @mixflame is there a source repo? cool project
<FromGitter> <Blacksmoke16> tl;dr should be possible as LLVM supports it, but its not a high priority atm. PRs would be ofc accepted
<FromGitter> <mixflame> @dscottboggs_gitlab https://github.com/mixflame/livepost
<FromGitter> <mixflame> thanks
<FromGitter> <mixflame> source link added to front page
<FromGitter> <dscottboggs_gitlab> nice
<FromGitter> <mixflame> :)
<FromGitter> <mixflame> thankfully there were not many breaking changes since I last updated the project
<FromGitter> <mixflame> it lives, again!
<FromGitter> <dscottboggs_gitlab> yes, I think the newest breaking change (the enums one) will lead to many broken dependencies
<FromGitter> <mixflame> is that in the next version?
<FromGitter> <Blacksmoke16> 1) 28.0 yes
<FromGitter> <mixflame> yikes
<FromGitter> <mixflame> whats the change?
<FromGitter> <dscottboggs_gitlab> right at the top
<FromGitter> <mixflame> yikes!
<FromGitter> <mixflame> i will pin to 0.27.2 until it gets figured out
<FromGitter> <Blacksmoke16> was that a common thing @dscottboggs_gitlab ?
<FromGitter> <mixflame> i'm lucky to have rescued my project before it got super insane
<FromGitter> <dscottboggs_gitlab> Yes, quite common
<FromGitter> <dscottboggs_gitlab> I've used it before
<FromGitter> <Blacksmoke16> all enums iv'e seen been newline separated
<FromGitter> <dscottboggs_gitlab> I've seen it in the stdlib and in other libraries
<FromGitter> <Blacksmoke16> hm, fair enough
jetpack_joe has quit [Ping timeout: 258 seconds]
<FromGitter> <dscottboggs_gitlab> Idk maybe I'm overestimating how common it was. Regardless, I'm writing a crystal tool to automatically handle it.
<FromGitter> <Blacksmoke16> :S
<FromGitter> <Blacksmoke16> wil formatter fix it?
<FromGitter> <dscottboggs_gitlab> oh that would be nice
<FromGitter> <dscottboggs_gitlab> I'll look into that instead of doing some hacky regex shit
<FromGitter> <Blacksmoke16> let me try it real quick
<FromGitter> <Blacksmoke16> ehh kinda
<FromGitter> <Blacksmoke16> replaced comma with `;`
<FromGitter> <Blacksmoke16> so good enough?
<FromGitter> <dscottboggs_gitlab> that's what I would've done
<FromGitter> <Blacksmoke16> well there you go :P
<FromGitter> <Blacksmoke16> welcome haha
<FromGitter> <dscottboggs_gitlab> very nice :)
* FromGitter * dscottboggs_gitlab is a bit tired
confact has quit [Ping timeout: 252 seconds]
<FromGitter> <Blacksmoke16> all good
<FromGitter> <Blacksmoke16> get my message the other day?
<FromGitter> <dscottboggs_gitlab> where is the source for the format tool?
<FromGitter> <Blacksmoke16> uhh sec
<FromGitter> <dscottboggs_gitlab> yeah I just didn't really have anything profound to say about it haha
confact has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> thank you
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <Blacksmoke16> made it to a friday at least :P
<FromGitter> <dscottboggs_gitlab> ugh... src/*compiler*/crystal/tools... I kept looking in `src/crystal` and being like "wtf there's nothing here" haha
confact has quit [Ping timeout: 252 seconds]
<FromGitter> <Blacksmoke16> yea
<FromGitter> <dscottboggs_gitlab> Yeah, gotta get my cars up for sale this weekend, the busses suck around here
<FromGitter> <Blacksmoke16> its *magic*
<FromGitter> <Blacksmoke16> :(
<FromGitter> <dscottboggs_gitlab> plz no magic lol
<FromGitter> <dscottboggs_gitlab> OMG that file is 4800 lines long wtf
<FromGitter> <Blacksmoke16> theres the magic
<FromGitter> <Blacksmoke16> lol
<FromGitter> <dscottboggs_gitlab> it's not magic it's just a damn novel
<FromGitter> <dscottboggs_gitlab> I get really annoyed that ⏎ ⏎ ```some_method call: "with", ⏎ many: "params", ⏎ too: "long", ⏎ to_fit: "on one line"``` ⏎ ⏎ and have been meaning to submit a PR but...jeeze...that's one hell of a complicated module. [https://gitter.im/crystal-lang/crystal?at=5cb12f1f759abc043cb119a0]
<FromGitter> <Blacksmoke16> ha i found a bug i think that been annoying me
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/shards/blob/master/SPEC.md#executables this only works when installing from a release not a branch
jetpack_joe has joined #crystal-lang
confact has joined #crystal-lang
<FromGitter> <Blacksmoke16> works on master so guess its fixed 💯
<FromGitter> <dscottboggs_gitlab> nice :)
<FromGitter> <Blacksmoke16> Indeed, I guess the question is now, when's the next release
return0e has quit [Ping timeout: 264 seconds]
return0e has joined #crystal-lang
DmitryBochkarev has joined #crystal-lang
DmitryBochkarev has quit [Ping timeout: 250 seconds]
DmitryBochkarev has joined #crystal-lang
DmitryBochkarev has quit [Ping timeout: 250 seconds]
teardown has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
boughtly has joined #crystal-lang
<boughtly> how can I use multidimensional StaticArray?
<boughtly> (like StaticArray(StaticArray(Int32, 5), 5) )
<boughtly> I can't seem to mutate them through var[0][0] = val
<FromGitter> <Blacksmoke16> does it work with a normal array/
<boughtly> Blacksmoke16: yes
<boughtly> I think the problem is that var[0][0] = val de-sugars to var.[](0).[]=(0, val)
<FromGitter> <Blacksmoke16> hmm
<boughtly> but since the first [] returns a copy of the inner array, the mutated one is discarded
<boughtly> I'm not sure what the best way to fix this is
<boughtly> (without using regular Array)
<FromGitter> <Blacksmoke16> which makes sense since staticarray inherits from value while array is reference
<boughtly> I'm wondering if there's a way to make it work anyway
<FromGitter> <Blacksmoke16> can you make a playground link of what you got atm?
DmitryBochkarev has joined #crystal-lang
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
return0e has quit [Ping timeout: 255 seconds]
return0e has joined #crystal-lang
DmitryBochkarev has quit [Ping timeout: 264 seconds]
mntmn has quit [Ping timeout: 252 seconds]
<jhass> boughtly: just do it in two steps, inner = outer[0]; inner[0] = 42; outer[0] = inner;
mntmn has joined #crystal-lang
<boughtly> jhass: I ended up using a pointer
<boughtly> thank you though
<jhass> well ^ is safer, ymmv
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
DmitryBochkarev has joined #crystal-lang
ashirase has quit [Ping timeout: 246 seconds]
ashirase has joined #crystal-lang
boughtly has quit [Ping timeout: 256 seconds]
DmitryBochkarev has quit [Ping timeout: 240 seconds]
<FromGitter> <Maroo-b> Hi, ⏎ Can someone please indicate where `typeof` is implemented in the source code?
<FromGitter> <r00ster91> I would search for `TypeOf` in the compiler code base
<FromGitter> <Maroo-b> thank you @r00ster91 , I was searching for `typeof` I guess that was the issue :)
Yxhuvud has joined #crystal-lang
DmitryBochkarev has joined #crystal-lang
DmitryBochkarev has quit [Remote host closed the connection]
DmitryBochkarev has joined #crystal-lang
<FromGitter> <j8r> @dscottboggs_gitlab automatically handle what? The formatter will automatically replace colons by new lines
<FromGitter> <j8r> colons as enum member delimiter wasn't that used. Plus, this wasn't a style consistent with the language
<FromGitter> <j8r> in the stdlib it was used in few places in specs, according to https://github.com/crystal-lang/crystal/commit/d1cdab24c8074e70938c45830336bf8a8999f6c3
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> it was commas that separated enum members, I thought? Yes @Blacksmoke16 mentioned that the formatter converts them to semicolons earlier thanks though
<FromGitter> <j8r> it was ether new line, semicolon or comma (yes sorry not colon)
<FromGitter> <j8r> and even space (bug fixed for 0.28.0)
<FromGitter> <Blacksmoke16> yes commas went to semicolons
Jenz_ has joined #crystal-lang
Jenz_ is now known as Jenz
<Jenz> Crystal stdlib spec is really cool
<Jenz> There's just some small features I'm missing
<FromGitter> <Blacksmoke16> heres a question, say im building a binary that will be added to a project's bin directory on install
<FromGitter> <Blacksmoke16> and i want to require that projects files within the binary
<FromGitter> <Blacksmoke16> im thinking you cant because you dont have the files when the binary is built
druonysus has quit [*.net *.split]
<FromGitter> <Blacksmoke16> well shit, whats plan b
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <Blacksmoke16> suppose i could have a command to generate a file in the project that can be ran to generate the documentation, not as optimal but oh well
olbat has quit [Ping timeout: 246 seconds]
olbat has joined #crystal-lang
Jenz has quit [Quit: leaving]
oz has quit [Ping timeout: 264 seconds]
oz has joined #crystal-lang
DmitryBochkarev has quit [Ping timeout: 246 seconds]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
lucasb has joined #crystal-lang
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
DTZUZO has quit [Ping timeout: 246 seconds]
DmitryBochkarev has joined #crystal-lang
alexherbo2 has joined #crystal-lang
teardown has quit [Read error: Connection reset by peer]
teardown has joined #crystal-lang
teardown has quit [Read error: Connection reset by peer]
teardown has joined #crystal-lang
teardown has quit [Ping timeout: 255 seconds]
DTZUZO has joined #crystal-lang
DTZUZU has quit [Ping timeout: 240 seconds]
DTZUZO has quit [Ping timeout: 240 seconds]
DTZUZO has joined #crystal-lang
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
alexherbo2 has joined #crystal-lang
<FromGitter> <ryanstout> is there a reason there's no Slice#to_io
<FromGitter> <elorest> `IO::Memory.new(bytes : Slice(Bytes))
<FromGitter> <elorest> https://crystal-lang.org/api/0.24.1/IO/Memory.html#new%28slice%3ABytes%2Cwriteable%3Dtrue%29-class-method
<FromGitter> <ryanstout> @elorest I've got an existing IO I want to append it to, hopefully in a single copy
<FromGitter> <ryanstout> I could do it with copy_to and some pointer work, but I figured #to_io on slice might make more since
<FromGitter> <elorest> a slice is basically just a linked list of (UInt8) in this case. What type is your IO?
<FromGitter> <ryanstout> IO::Memory
<FromGitter> <ryanstout> building up a buffer to send over usb
<FromGitter> <ryanstout> from a slice
<FromGitter> <elorest> Were appending bytes without issue to an existing IO there.
<FromGitter> <ryanstout> ok, so maybe .write is the way to go then
<FromGitter> <ryanstout> thanks
<FromGitter> <elorest> For sure.
<FromGitter> <elorest> Now back to my Taxes :(
<FromGitter> <ryanstout> best of luck
<FromGitter> <ryanstout> my small company's were 175 pages this year :-)
<FromGitter> <elorest> Crazy. I just use turbotax but between home sale, investment property sale, IRA, moving states, 1099's, it's becoming difficult.
<FromGitter> <ryanstout> yea
<FromGitter> <ryanstout> one other question, is there a good way to do fiber local variables?
<FromGitter> <r00ster91> A local variable inside of a fiber?
<FromGitter> <ryanstout> like ruby thread locals: ```Thread.current[:something] = 5```
<FromGitter> <ryanstout> but for fibers
<FromGitter> <ryanstout> or a good way to accomplish the same thing
<FromGitter> <elorest> local variables inside of fibers should only be accessable from within that block, to begin with. I use channels to send recieve information from fibers.
<FromGitter> <ryanstout> maybe I should explain my use case. I've got a usb device I'm interacting with where commands get sent in parts all with the same transaction_id passed along. Theres different methods to build up a transaction across a few classes (it's complicated) My goal was to have multiple transactions being able to run at once across more than one fiber. So my idea was to use something like a thread local to keep
<FromGitter> ... track of the current transaction id. (I realize I should probably pass it around, but this would clean up the API quite a bit at the cost of less clarity on that detail)
<FromGitter> <ryanstout> anyway, I can figure something out, was trying to avoid passing transaction id's through every method, but that might be the clearest
<FromGitter> <dscottboggs_gitlab> yeah you should be able to just do something like ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5cb2487525686a7dc3270db1]
<FromGitter> <ryanstout> @dscottboggs_gitlab maybe I'm not explaining it right. Have you used thread locals in or similar?
<FromGitter> <elorest> @ryanstout Maybe we're not understanding you but a local variable should remain in the fiber and be callable from inside it.
<FromGitter> <ryanstout> @elorest so so the idea would be to have it where any of my code could grab the current transaction_id for that fiber (since there might be more than one transaction going on at once, but only one in each fiber)
<FromGitter> <dscottboggs_gitlab> I haven't used thread locals before, if they mean something other than a variable local to the thread then that could be our misunderstanding
<FromGitter> <ryanstout> but from whereever, not just the scope where I setup a local
<FromGitter> <dscottboggs_gitlab> Oh I see
<FromGitter> <dscottboggs_gitlab> perhaps you could implement a struct which internally handles spawning and stores the data you're referring to next to the reference to the fiber?
<FromGitter> <ryanstout> I could maybe create a lookup using ```Fiber.current``` as the key
<FromGitter> <ryanstout> yea
<FromGitter> <ryanstout> thats probably the best way to do it
<FromGitter> <ryanstout> thanks
<FromGitter> <dscottboggs_gitlab> np
<FromGitter> <dscottboggs_gitlab> that would be a nice feature -- perhaps there could be a module which could be included to create custom structs of data associated with a fiber.
<FromGitter> <elorest> Ok. My understanding of thread locals was that ruby handled threads differently and therefore this was necessary to saparate variables between threads.
<FromGitter> <elorest> In your case I would probably just push the information along with the fiber id to a global hash of some type.
<FromGitter> <elorest> Similar to line 3, 6, and 16 of this example. ⏎ https://gist.github.com/elorest/b47fffb6f6997e0532a5e97769da7849
<FromGitter> <dscottboggs_gitlab> something like ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Aaaand that would never work [https://gitter.im/crystal-lang/crystal?at=5cb24abb8148e555b29d753c]
<FromGitter> <ryanstout> thanks for the help. I've got something I think will work. thanks
<FromGitter> <dscottboggs_gitlab> It's cool I just think it would be a cool feature for the language and was trying to figure out some way it could work easily for everyone.
<FromGitter> <dscottboggs_gitlab> Crystal's MT and concurrency system feels to me like it could use some work
<FromGitter> <ryanstout> making concurrency easy is something CS had been trying to do for 50+ years now. :-)
<FromGitter> <ryanstout> some day
<FromGitter> <dscottboggs_gitlab> yup
<FromGitter> <ryanstout> I'm happy having evented io without promises or async/await
<FromGitter> <dscottboggs_gitlab> oof yeah that's true
<FromGitter> <straight-shoota> > I could maybe create a lookup using ```Fiber.current``` as the key ⏎ ⏎ Yeah, that's the recommended approach. You could also reopen `Fiber` and add a custom instance var. But using the current fiber as a key is probably the best.
<FromGitter> <ryanstout> @straight-shoota thanks
<FromGitter> <ryanstout> sorry, running into a lot of questions today I can't find the answers to anywhere. Is there a way to get the underlying type of an enum at compile time? (doing a .read_bytes from an io)
<FromGitter> <ryanstout> generically for any enums
tsundsted has joined #crystal-lang
<FromGitter> <bajro17> does anyone plan to record tutorials for crystal lang and put on udemy?
moei has joined #crystal-lang
DmitryBochkarev has quit [Ping timeout: 250 seconds]
<FromGitter> <dscottboggs_gitlab> Does anyone know a way to debug crystal code *with* watched variables?
<FromGitter> <tenebrousedge> @dscottboggs_gitlab this might be useful: https://docs.amberframework.org/amber/examples/crystal-debug
<FromGitter> <dscottboggs_gitlab> oof #4457 :(
<DeBot> https://github.com/crystal-lang/crystal/issues/4457 (LLDB don't show frame variables while debugging)
<FromGitter> <dscottboggs_gitlab> "as a workaround (https://docs.amberframework.org/amber/examples/crystal-debug#2-avoid-breakpoints-inside-blocks), just don't use a debugger, fall back on printing to the terminal"
tsundsted has quit [Ping timeout: 256 seconds]
tsundsted has joined #crystal-lang
DTZUZO has quit [Ping timeout: 268 seconds]
lucasb has quit [Quit: Connection closed for inactivity]