<FromGitter>
<jrei:matrix.org> The playground uses websockets?
<FromGitter>
<jrei:matrix.org> Ho yes...
<FromGitter>
<jrei:matrix.org> The playground being in the compiler does not make things easy...
<FromGitter>
<oprypin:matrix.org> is it commonly accepted that applications should commit shard.lock, while libraries shouldn't?
<FromGitter>
<Blacksmoke16> pretty much yea
<FromGitter>
<jrei:matrix.org> Because a library is not used directly
<FromGitter>
<oprypin:matrix.org> nice thx
<FromGitter>
<jrei:matrix.org> Locking versions allows to reproduce a build – by the way as you knoe not that true because nothing stops to modify tags
<FromGitter>
<jrei:matrix.org> I could be possible to even not have SHA1, but it will be insecure...
<FromGitter>
<jrei:matrix.org> Which could be fine actually, if only used locally
<FromGitter>
<oprypin:matrix.org> yes i know that sucky part about it
<FromGitter>
<Blacksmoke16> is there a way to type restrict an argument to a key/value enumerable?
<FromGitter>
<Blacksmoke16> namedtuple isnt an enumerable
<FromGitter>
<jrei:matrix.org> Right. Why giving this then?
<FromGitter>
<Blacksmoke16> just so happened is what i tested with first
<FromGitter>
<jrei:matrix.org> Or maybe Enumerable | NamedTuple haha
<FromGitter>
<Blacksmoke16> i just made it `Hash`, as apparently named tuple doesnt support `join` anyway so im just passing the `**params` to other overload via `params.to_h` :shrug:
<FromGitter>
<Blacksmoke16> worst case you just need to `**nt`
<FromGitter>
<Blacksmoke16> or call `.to_h` on it
<hightower2>
hm why doesn't this work? https://carc.in/#/r/ac49 (could be obvious, but I'm tired yet trying to finish something up)
<FromGitter>
<Blacksmoke16> wrap em in `{% begin %}`/`{% end %}`
<hightower2>
worked, danke schoen
<FromGitter>
<Blacksmoke16> 👍
<hightower2>
Ah one more, what am I doing wrong here? https://carc.in/#/r/ac4b (Tried to explain my purpose below the macro)
<hightower2>
ah parens () for one at least, so that it treats it as a hash instead of block
<FromGitter>
<Blacksmoke16> yea, thats what i was going to say
<hightower2>
m indeed, that was the only issue. ok awesome
<hightower2>
(and that m.resolve had to be m.id, that was just mispaste in the carc example)
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<hightower2>
one thing remains in that paste... when I do {% for m in Tput::Key.constants %} EventHandler.event {{m.id}} that basically changes what 'm' is... so instead of a hash with ( Tput::Key => Event ), I end up with a hash of ( Event => Event )
<hightower2>
or hm, not sure if that's accurate description
<hightower2>
how can I ask a class to give me its constant? Like {% ha[ Tput::Key[m] ] = m %}
<hightower2>
Have this so far: https://carc.in/#/r/ac4c ... but Tput::Key.constant(m) gets me the enum value back (Int32) rather than enum member itself
<FromGitter>
<Blacksmoke16> not sure i follow what the goal is there
<hightower2>
But I wanted to avoid assigning in runtime the elements one by one
<FromGitter>
<Blacksmoke16> wouldnt it be easier to do that as a method on the enum?
<hightower2>
it would, but I can't do this as a built-in feature of Tput::Key, must do it in/from the project that uses it as a dependency
<hightower2>
so not sure how I'd do that
<FromGitter>
<Blacksmoke16> ok
<hightower2>
I guess the only final improvement to what I have in that last paste would be if I could somehow generate the complete hash and assign it at once, instead of basically using macros to generate hash assignments in a key-by-key fashion
<FromGitter>
<oprypin:matrix.org> hightower2, heh dont feel too bad about that, a hash literal has no difference from creating an empty hash and adding items one by one at runtime
<hightower2>
great, useful to know, thanks
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 265 seconds]
deavmi has joined #crystal-lang
<FromGitter>
<jrei:matrix.org> Maybe there is an optimization with the hash literal with the initial capacity?
<FromGitter>
<oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org): @hightower2 i just looked at the difference in llvm ir generated by the two cases, and they're definitely different enough that i seriously doubt my claim now
<FromGitter>
<oprypin:matrix.org> no hold on, i made a mistake in the comparison
<hightower2>
Right, yeah re. capacity I already added the default amount since I know how many elements there will be. But I thought there were other differences too.
<hightower2>
Hm is there a way to ask how many members an enum has?
<hightower2>
seems silly to call #names.size or the like...
<hightower2>
What's my best bet to install a timeout on IO#read_char ? Do I really resort to setting io.read_timeout= even though I only sometimes need to read with a timeout?
<hightower2>
(and other/most times without a timeout)
<hightower2>
ok done so for now, setting and resetting io.read_timeout before/after reading if a read with timeout is to happen
<yxhuvud>
How cute. Now my test suite ends in a BUG 50% of the time and passes the rest.
<yxhuvud>
nah, it is the event loop that somehow wakes a fiber it shouldn't. Which is a very fair error considering I'm monkeypatching half the event loop. just a bit irritating to get it only sometimes.
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Read error: Connection reset by peer]
<FromGitter>
<Blacksmoke16> afaik thats breaking RFC when the response status is 304
hightower2 has quit [Ping timeout: 246 seconds]
hightower2 has joined #crystal-lang
hightower2 has quit [Ping timeout: 264 seconds]
hightower2 has joined #crystal-lang
_ht has quit [Remote host closed the connection]
<FromGitter>
<gunn> @Blacksmoke16 Hey, thanks for helping me with my server stuff a couple of days ago - the problem was what you suggested - chrome blocking parallel loads, when I test with curl it works perfectly.
<raz>
looks like there are a bunch more cases where content-length needs special care
<FromGitter>
<Blacksmoke16> @gunn nice! good to hear
postmodern has joined #crystal-lang
<postmodern>
does crystal support something like Class#prepend which puts the module above the Class in the ancestory hiearchy, allowing it to intercept method calls and then call super().
<FromGitter>
<Blacksmoke16> im pretty sure if you redefine a method from a module in a class and call `super` it'll invoke the module's implementation
<FromGitter>
<jrei:matrix.org> you can't manipulate the program structure at runtime
<postmodern>
Blacksmoke16, prepend works differently. it let's you define a method from the class, but in the module, and calling super will call the class'es method
<hightower2>
I seem to remember asking this question years ago (since I wanted it like it works in Ruby) and was told it doesn't exist.
<FromGitter>
<Blacksmoke16> yea idt thats a thing
<FromGitter>
<Blacksmoke16> got an example of how it would work?
<FromGitter>
<Blacksmoke16> like is it just allowing you to call the modules implementation before the classes? or?
<hightower2>
Just instead of `include` which adds it to the end/most recent in the list, this one adds it at the start/most far away
<hightower2>
basically it's an unshift into the list of parents
<FromGitter>
<Blacksmoke16> ofc if a module defines a method and the class doesnt override it, the module is what'll be called. If the class overrides it, it can call `super` to use the modules implementation first
<postmodern>
Blacksmoke16, also you can do `super if defined?(super)` in case the class doesn't define the method, although `defined?` always struck me as a bit too magical.
<postmodern>
also lets you do things like wrap around super and catch exceptions, modify input arguments, modify return values, all without the class'es method realizing it