kfpratt has quit [Remote host closed the connection]
ytti has joined #crystal-lang
ytti has quit [*.net *.split]
buggs has quit [Quit: WeeChat 0.4.2]
ytti has joined #crystal-lang
ragmaanir__ has quit [Quit: Leaving]
ytti has quit [Ping timeout: 240 seconds]
kfpratt has joined #crystal-lang
ytti has joined #crystal-lang
ytti has quit [*.net *.split]
ytti has joined #crystal-lang
ytti has quit [Ping timeout: 240 seconds]
ytti has joined #crystal-lang
pawnbox has joined #crystal-lang
zeno_ has quit [Remote host closed the connection]
zeno_ has joined #crystal-lang
ytti has quit [Ping timeout: 240 seconds]
kfpratt has quit [Remote host closed the connection]
zeno_ has quit [Client Quit]
pawnbox has quit [Ping timeout: 264 seconds]
zeno_ has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
ytti has joined #crystal-lang
ytti has quit [*.net *.split]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
ytti has joined #crystal-lang
ytti has quit [Ping timeout: 240 seconds]
ytti has joined #crystal-lang
ytti has quit [*.net *.split]
ytti has joined #crystal-lang
ytti has quit [Ping timeout: 240 seconds]
ytti has joined #crystal-lang
ytti has quit [Ping timeout: 240 seconds]
ytti has joined #crystal-lang
ytti has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
ytti has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
ytti has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
ytti has joined #crystal-lang
ozra has joined #crystal-lang
ytti has quit [*.net *.split]
hangyas has joined #crystal-lang
<hangyas>
has anybody else trouble with the summer daylight saving time?
ytti has joined #crystal-lang
ytti has quit [*.net *.split]
edjsu has quit [Quit: WeeChat 1.2]
edjsu has joined #crystal-lang
hangyas has quit [Quit: hangyas]
hangyas has joined #crystal-lang
hangyas has quit [Ping timeout: 246 seconds]
<BlaXpirit>
trouble waking up?
bjz_ has joined #crystal-lang
Ven has joined #crystal-lang
bjz has quit [Ping timeout: 246 seconds]
trapped has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
zeno_ has quit [Quit: 离开]
Rinkana has joined #crystal-lang
Philpax has quit [Ping timeout: 244 seconds]
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14>
Is there a promise library for crystal yet?
ozra has quit [Ping timeout: 276 seconds]
Ven has joined #crystal-lang
bjz_ has quit [Ping timeout: 244 seconds]
bjz has joined #crystal-lang
dome22xl has joined #crystal-lang
Ven has quit [Client Quit]
marcosdsanchez has quit [Ping timeout: 264 seconds]
marcosdsanchez has joined #crystal-lang
Ven has joined #crystal-lang
dome22xl has quit [Read error: Connection reset by peer]
pawnbox has quit [Remote host closed the connection]
Ven has quit [Client Quit]
pawnbox has joined #crystal-lang
hangyas has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
<RX14>
BlaXpirit, why did you implement the network module in crsfml?
zeno_ has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
bjz_ has joined #crystal-lang
<BlaXpirit>
RX14, cuz why not
<BlaXpirit>
i'm sure it has some features that crystal doesnt
<RX14>
ehh
<RX14>
maybe
<RX14>
I sure wouldn't use them
Philpax has joined #crystal-lang
pawnbox has joined #crystal-lang
<Rinkana>
Can a crystal file return an array? Like that you can call something like File.read and it returns an array of objects?
<RX14>
a crystal file?
<BlaXpirit>
Rinkana, maybe you're looking for json
<BlaXpirit>
or maybe just a `require`
<RX14>
oh, you want to
<RX14>
use the crystal file module
<RX14>
to open multiple files at once?
<RX14>
you want to make an array of the filenames then use .map to map them to their contents
<RX14>
["file", "file2"].map { |f| File.read f }
<Rinkana>
No, i want to define an array of objects within that file. And the only use of that file is for that array. And when i open that file i get the array.
<Rinkana>
Let me create a snippet of what i want to achive
<RX14>
like the nodejs require system? where you require a file and it retuns an object?
matp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Rinkana>
RX14 thanks, that was indeed the only thing needed
Ven has joined #crystal-lang
pawnbox has joined #crystal-lang
matp has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
bjz_ has quit [Ping timeout: 244 seconds]
bjz has joined #crystal-lang
A124 has quit [Ping timeout: 240 seconds]
splattael has joined #crystal-lang
ragmaanir has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
zeno_ has quit [Remote host closed the connection]
tony_ has joined #crystal-lang
matp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 252 seconds]
matp has joined #crystal-lang
marcosdsanchez has quit [Read error: Connection reset by peer]
marcosdsanchez has joined #crystal-lang
tony_ has quit [Ping timeout: 264 seconds]
Philpax has quit [Ping timeout: 246 seconds]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tony_ has joined #crystal-lang
hangyas has quit [Remote host closed the connection]
hangyas has joined #crystal-lang
tony_ has quit [Ping timeout: 260 seconds]
ozra has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
splattael has quit [Quit: Connection closed for inactivity]
mgarciaisaia has quit [Quit: Leaving.]
bjz_ has quit [Ping timeout: 244 seconds]
krtv` has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
nstnst has joined #crystal-lang
<nstnst>
hello everyone, was curious if anyone could help me out with some concurrency features of crystal. I was wondering if there's a technique for coordination between multiple fibers, kind of like golang's sync.WaitGroup or sync.Once. More details in this ticket: https://github.com/crystal-lang/crystal/issues/2366
<RX14>
nstnst, waitgroup can be accomplised using the parallel macro
<nstnst>
RX14: Thanks for the pointer! Looks like it might get close to what I want, but what if I have two fibers and I want to know which one finishes first? Looks like that parallel macro waits for all jobs to complete?
<RX14>
yep it does
<RX14>
you will probably have to rig it all together with channels
<RX14>
you can see the concept
<RX14>
that a fiber sends a "nil" as a marker down a channel when it completes
<RX14>
if you only want one to finish, only recieve once on the channelk
<RX14>
then kill the other fibers once you recieve that
<RX14>
and if your fibers return a value - might as well return that value down the channel
<RX14>
channels are the main way of communication between fibers
<RX14>
and they work very well
<nstnst>
cool, very go like
<RX14>
there probably should be something in the standard library for this
<RX14>
but it's early days
<nstnst>
:) Totally, I would love to see it
<nstnst>
another question: In other langs I might expect that channel receive / channel send to have a mutex around it. Why don't require it here? Is it how fibers are scheduled? (still learning crystal :))
<nstnst>
mutex lock *
<RX14>
fibers only run on one core
<RX14>
so you don't really need it at the moment
<RX14>
it's like node, in that you have to run one crystal process per core
<RX14>
that SHOULD change in the future though
<RX14>
unlike node
<nstnst>
word, is there a ticket for that change? would love to read more
<RX14>
nodejs can get away with being single core because it's meant for servers
<RX14>
crystal is designed to be more general purpose, so we should be able to schedule coroutines over multiple cores
<nstnst>
RX14: one last thing if you don't mind: In my experiements, I've had some fibers that I expect to run for a long time, and would prefer that the short running fiber executes quickly and short-circuit the long-running one. I want to learn more about what garuntees I can make for this; is there more reading material on how the fibers are scheduled? I recall reading something about switching them after a certain timing threshol
<RX14>
fibers are cooperatively scheduled
<RX14>
fibers yield their own control
<nstnst>
"A fiber must explicitly tell the Runtime Scheduler to switch to another fiber. For example if there's I/O to be wait, a fiber will tell the scheduler "Look, I have to wait for this I/O to be available, you continue executing other fibers and come back to me when that I/O is ready"."
<RX14>
the trick is, that IO calls yield that control for you
<RX14>
so, unless your fiber makes blocking calls it will run forever
<RX14>
in go, fibers are scheduled on method calls
<RX14>
or something like that
<RX14>
so if you have a method with an infinite loop, it will never yield
pawnbox has quit [Remote host closed the connection]
<nstnst>
RX14: What if I have a fiber that is simply waiting for a timeout to signal a short-circuit
pawnbox has joined #crystal-lang
<RX14>
sleep reschedules the fiber too
<nstnst>
RX14: Interesting; so when that sleep finishes, the fiber will be re-scheduled to be called again?
<RX14>
nstnst, trouble is that IO calls should be more wrapped than slep calls so they will probably just reschedule themselves when they are resumed, so you can never manually resume them
<nstnst>
RX14: Thanks! I think I'll play around with it a bit more :) Thanks again for all your help
<nstnst>
RX14: gotcha; yeah it sounds like multi-core is what I'd be looking for