<yxhuvud>
lbarasti: runnables only contain fibers that are waiting for execution but not executing yet. It does not contain the actually running threads and also not the ones waiting for io or sleeping or whatever.
<yxhuvud>
additionally, it is not a thread safe interface - not only is the way you list them inherently racy, there is also that runnables is a normal deque and unsafe - ie it not intended to be accessed from outside the scheduler.
<yxhuvud>
(and no, there is currently no way to access what you want)
<FromGitter>
<phykos> I mean is this the correct behavior?
<FromGitter>
<grkek> I think that the receive function will wait forever until it receives something.
<FromGitter>
<phykos> uhh right
<FromGitter>
<phykos> btw, what does capacity mean when you construct a channel?
<FromGitter>
<phykos> I mean the only argument Channel.new takes
<FromGitter>
<grkek> How many calls can be captured in the queue probably
<FromGitter>
<grkek> c.send(T) where T is any type you want
<FromGitter>
<grkek> and when you send the data there probably is a queue which gathers up the information for the c.receive function
<FromGitter>
<grkek> :)
<FromGitter>
<phykos> its documentation time
<FromGitter>
<grkek> Good luck ;)
<FromGitter>
<AlesLulak> Hi, hopefully there is a space for a newbie question. I use hash as `options`, the hash value is an union type (Bool | Int32 | String), but I have a method accepting only exact types as arguments. So I created a kind of hack, but I am not sure is this a good solution. Is there a better way to achieve this? Sending example: ⏎ ⏎ ```code paste, see link``` [https://g
<FromGitter>
<phykos> @asterite I have to set that value right before calling `STDOUT.write_byte`? ⏎ I defined a function where basically it does what it has to do, including writing to the stdout, but it does nothing, it keeps the things as they were before
<FromGitter>
<phykos> @AlesLulak tip: sometimes the return keyword isn't even needed in Crystal, much like Ruby
<FromGitter>
<HertzDevil> @AlesLulak use a NamedTuple instead, no need for unions here
<oprypin>
AlesLulak, yes the only real problem in that code **is** the fact that `options` is a mixed `Hash`
<FromGitter>
<lbarasti> > *<yxhuvud>* runnables only contain fibers that are waiting for execution but not executing yet. It does not contain the actually running threads and also not the ones waiting for io or sleeping or whatever. ⏎ Makes sense, thanks, this clarifies it for me. ⏎ ⏎ > *<yxhuvud>* additionally, it is not a thread safe interface - not only is the way you list them inherently racy, there is also that runnables
<FromGitter>
... is a normal deque and unsafe - ie it not intended to be accessed from outside the scheduler. ⏎ Yes, this I appreciate, and do understand the risk. Anyhow, I'll open a forum topic to gather all these info, really appreciate you chiming in 👍 [https://gitter.im/crystal-lang/crystal?at=5f82d9046e1aa94de7f155ab]
<FromGitter>
<lbarasti> > *<yxhuvud>* additionally, it is not a thread safe interface - not only is the way you list them inherently racy, there is also that runnables is a normal deque and unsafe - ie it not intended to be accessed from outside the scheduler. ⏎ ⏎ Yes, this I appreciate, and do understand the risk. Anyhow, I'll open a forum topic to gather all these info, really appreciate you chiming in 👍
<FromGitter>
<AlesLulak> @HertzDevil aha! Thank you. I must read through the references, I forgot about NamedTuple. ⏎ @oprypin sorry, what does a mixed hash exactly mean?
<oprypin>
AlesLulak, `{} of Symbol => (Int32 | String | Bool)` mixed because its values are a union type
<FromGitter>
<AlesLulak> oh, sure. And that's a bad approach, right?
<oprypin>
AlesLulak, usually yes. you can see it's bad because of the problems you're running into :)
<FromGitter>
<AlesLulak> thanks for the insight
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
twistedpixels has quit [*.net *.split]
twistedpixels has joined #crystal-lang
postmodern has quit [Quit: Leaving]
scott_tams has joined #crystal-lang
<scott_tams>
hello...is it possible to store an Array of classes or Hash of string to classes, to then later access methods on all of them?
<FromGitter>
<Blacksmoke16> like iterate the methods on that type at runtime?
<scott_tams>
no, call the same method on a bunch of classes
<scott_tams>
all the classes implement =~ so I want to check all of them and see if they match
<FromGitter>
<Blacksmoke16> oh yea that should be possible
<FromGitter>
<Blacksmoke16> build out the array of types at compile time
<scott_tams>
Ah that's perfect. I was trying to do it without the parent class and they aren't all within the same module so it was just not working lol
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<Blacksmoke16> do you have an example of what you're ultimately trying to do?
<FromGitter>
<Blacksmoke16> if the values you're comparing as part of `=~` are known at compile time you could do that logic also at compile time
<scott_tams>
I have a json document with many types which I then use to generate a Crystal library (and a C++ one as well) to convert between all the different unit types in the document.
<scott_tams>
I'm adding a CLI to the Crystal library, so when you pass the command, for example `1000 mm to meters` it will find the classes associated with `mm` and `meters`, and eventually call `Millimeter.new(count).to "m"`
<scott_tams>
or rather, `.to Meter.abbr`
<FromGitter>
<Blacksmoke16> fair enough
<scott_tams>
whoo I got it working! Thanks @Blacksmoke16, I knew you could help :joy:
<FromGitter>
<Blacksmoke16> np
<FromGitter>
<RespiteSage> Ooh. Someone's working on a Unit library?
<FromGitter>
<RespiteSage> / application?
<scott_tams>
yeah it's working just gotta put some polish on it.
<FromGitter>
<RespiteSage> I look forward to seeing it (assuming it's open-source). :)
scott_tams has quit [Remote host closed the connection]
Stephie has quit [Quit: Fuck this shit, I'm out!]
Vexatoast has joined #crystal-lang
Vexatos has quit [Ping timeout: 260 seconds]
Stephie has joined #crystal-lang
Stephie has quit [Excess Flood]
Stephie has joined #crystal-lang
duane has joined #crystal-lang
ryanprior has quit [Quit: authenticating]
Seich has quit [Quit: Gone fishing.]
Seich has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
<FromGitter>
<incognitorobito> Hey folks, I'm trying to build the compiler on Windows and I keep hitting a linker error with LLVM. Has anyone seen this before?