Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:51
    caspiano edited #11517
  • 02:17
    caspiano synchronize #11517
  • Dec 01 22:53
    straight-shoota synchronize #11523
  • Dec 01 22:51
    straight-shoota closed #11498
  • Dec 01 22:49
    straight-shoota closed #11469
  • Dec 01 22:49
    straight-shoota closed #10984
  • Dec 01 22:48
    straight-shoota closed #11446
  • Dec 01 22:42
    straight-shoota opened #11523
  • Dec 01 22:42
    straight-shoota labeled #11523
  • Dec 01 22:42
    straight-shoota labeled #11523
  • Dec 01 21:55
    straight-shoota synchronize #11472
  • Dec 01 21:29
    straight-shoota synchronize #11472
  • Dec 01 21:13
    straight-shoota synchronize #11472
  • Dec 01 21:12
    straight-shoota milestoned #11521
  • Dec 01 21:12
    straight-shoota milestoned #11298
  • Dec 01 20:57
    beta-ziliani synchronize #11485
  • Dec 01 17:19
    straight-shoota review_requested #11522
  • Dec 01 17:19
    straight-shoota labeled #11522
  • Dec 01 17:19
    straight-shoota labeled #11522
  • Dec 01 17:19
    straight-shoota opened #11522
mfiano
@mjfiano:matrix.org
[m]
Heh, you're right. That is easy. I do have one complaint about the compiler here though.
George Dietrich
@Blacksmoke16
oh?
mfiano
@mjfiano:matrix.org
[m]
When i include Indexable(T), the compiler was smart enough to tell me I didn't implement unsafe_fetch. After I implemented that and tried using it, the compiler ended up overflowing the stack due to recursing infinitely. It wasn't until I implemented size that it worked. It makes me wonder why it just blew the stack instead of complaining that I didn't implement size.
George Dietrich
@Blacksmoke16
hm
got a small example of that behavior? I have a theory
From IRC (bridge bot)
@FromIRC
<straight-shoota> The problem is that Indexable#size is actually implemented by it's ancestor Enumerable#size
mfiano
@mjfiano:matrix.org
[m]
I will make one on play
George Dietrich
@Blacksmoke16
yea that was my guess ^ which its implementation just iterates the whole thing to figure out
From IRC (bridge bot)
@FromIRC
<straight-shoota> Relevant issues are crystal-lang/crystal#10014
<straight-shoota> and crystal-lang/crystal#9998
mfiano
@mjfiano:matrix.org
[m]
George Dietrich
@Blacksmoke16
yea, reason is what @straight-shoota said
mfiano
@mjfiano:matrix.org
[m]
Ah I see
This ability to make anything indexable/iterable/whatever-able is fantastic.
Thank you for opening my blind eyes after reading the docs/api multiple times
mfiano
@mjfiano:matrix.org
[m]
It appears more has to be implemented, or what is the error here? https://play.crystal-lang.org/#/r/blfw
Emilia
@rymiel:rymiel.space
[m]
wouldn't your unsafe_fetch here return a nilable value
because there's no else in the case
mfiano
@mjfiano:matrix.org
[m]
Hmm how do I fix it?
Emilia
@rymiel:rymiel.space
[m]
have an else which throws an exception?
speaking of, is there no way to view the --error-trace on carc.in?
George Dietrich
@Blacksmoke16
prob raise if index isnt 0 or 1 then just do like idx.zero? ? @x : @y
mfiano
@mjfiano:matrix.org
[m]
Yeah for this type. Also have 3d (x y z), and 4d (x y z w) types
George Dietrich
@Blacksmoke16
case + else with exception prob be the way to go then
From IRC (bridge bot)
@FromIRC
<riza> how does log.context get "inherited" when a fiber is spawned? I had assumed there was something in spawn/Fiber that called a .dup or .clone on the ivars on Fiber at .new time but I don't see it
George Dietrich
@Blacksmoke16
does it inherit context?
mfiano
@mjfiano:matrix.org
[m]
Spent a while trying to figure out why Number#negative? was erroring out. Looks like I am still on 1.0.0. Also looks like I need a break :/
George Dietrich
@Blacksmoke16
hey that was my feature :P
From IRC (bridge bot)
@FromIRC
<riza> @blacksmoke16 as far as I can tell, when a fiber is created, nothing is passed in from the current fiber: https://github.com/crystal-lang/crystal/blob/6a3f6b1e89be89dbe32a66a11da92d35e7790977/src/concurrent.cr#L61
<riza> but maybe that's implicit somewhere else
George Dietrich
@Blacksmoke16
right, so what makes you think it does get inherited?
From IRC (bridge bot)
@FromIRC
<riza> hhhhhhhhhhhhhhhhhhmmmm I don't know where I saw that
<riza> the log context metadata does have the ability to inherit
From IRC (bridge bot)
@FromIRC
<riza> this test seems to point that you're right and things aren't getting inherited though https://github.com/crystal-lang/crystal/blob/dd40a2442fa186add8a82b74edb14a90aa1dae05/spec/std/log/context_spec.cr#L62-L78
<riza> if they were being inherited I'd expect there to be an assertion in here which proves that a == 1 too
George Dietrich
@Blacksmoke16
yea, makes sense
pretty sure there's a way to set the context on a fiber tho
From IRC (bridge bot)
@FromIRC
<riza> there is, for sure
<riza> Fiber#current_context= is available
<riza> sorry #logging_context=, not #current_context= https://github.com/crystal-lang/crystal/blob/master/src/log/metadata.cr#L222-L230
<riza> that's fine. I was hoping there was some magic which let log inherit instances of itself from the parent fiber
<riza> thanks :⁠)
From IRC (bridge bot)
@FromIRC
<riza> man, now my head is spinning. this looks right to me: https://carc.in/#/r/blh6
<riza> same result here: https://carc.in/#/r/blh8
<riza> man how is carc.in so fast when crystal play is so slow
George Dietrich
@Blacksmoke16
i think only metadata is serializable, not context
From IRC (bridge bot)
@FromIRC
* riza derp
<riza> this api is kind of confusing, because you call #set on the context but if you want to render all the things you've set you have to call context.metadata