jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
riffraff169 has left #crystal-lang [#crystal-lang]
<hightower2> ehm in a test suite, how do I mark some specs to not execute?
<FromGitter> <Daniel-Worrall> pending
<hightower2> ah pending instead of 'it'.. I was trying with it..., pending: true
<hightower2> thanks
deavmi_ has quit [Ping timeout: 260 seconds]
riffraff169 has joined #crystal-lang
deavmi has joined #crystal-lang
aquijoule__ has joined #crystal-lang
aquijoule_ has quit [Ping timeout: 240 seconds]
<FromGitter> <watzon> Trying to remember, is there a shorthand for this? `proc = ->(a : Int32) { some_other_method(a) }`
<FromGitter> <watzon> Basically a shorthand for passing around a proc that wraps a method
<FromGitter> <Blacksmoke16> `->some_other_method(Int32)`?
<FromGitter> <watzon> Ahhh yeah
<FromGitter> <watzon> I was doing `&->some_other_method`, but that's for passing a proc to a block
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 264 seconds]
<FromGitter> <watzon> I'm so confused ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fed4c16aa6bb528c3801a5b]
<FromGitter> <watzon> Am I just super tired? Because I don't see how `@@constructor_id` could be an `Int32`
<FromGitter> <Blacksmoke16> Hmm
avane has quit [Quit: ZNC - https://znc.in]
<FromGitter> <Blacksmoke16> sure you're not setting it in some other file
<FromGitter> <Blacksmoke16> or twice or something
<FromGitter> <watzon> Yep, just accessing it
<FromGitter> <Blacksmoke16> got the code somewhre?
<FromGitter> <watzon> Ahhhh I know the problem. In the parent class I had set `constructor_id` as a `Int32 | Int64`, so just trying to constrain it to `Int64` was breaking it.
<FromGitter> <Blacksmoke16> well there you go :p
avane has joined #crystal-lang
<FromGitter> <RespiteSage> Is there a way to do math at compile-time with a generic type variable?
<FromGitter> <RespiteSage> I'm trying to represent a square chunk of a particular width `R` with a `StaticArray(T, R * R)`. That code doesn't work, and it seems like it's not treated as a constant for use in macros.
<FromGitter> <watzon> Afaik there isn't, but that would be nice to have
<FromGitter> <RespiteSage> Ah, well. Probably I can start with `Array` and optimize to `StaticArray` if really necessary.
<FromGitter> <watzon> Why tf does `StringLiteral` have a `gsub` method, but no `sub` method?
<FromGitter> <watzon> Still need to write tests and better docs for it, but this is about ready to be used https://github.com/protoncr/async/
<FromGitter> <watzon> Basically a `Future` implementation that more closely resembles Python's `asyncio.Future` along with `asyncio.Event` and `async` / `await` macros which utilize those futures.
_whitelogger has joined #crystal-lang
<FromGitter> <watzon> Is there a limit to the number of subclasses an abstract class can have? Because I think I may have found it.
<FromGitter> <erdnaxeli:cervoi.se> I am a bit worried that you are introducing colors in a language that isn't colored, but I am not sure how your async / await keywords work, you should provide examples. ⏎ (by colored language I am referring to https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ )
<FromGitter> <watzon> Yeah this is more for internal use in a project I'm working on than anything. The `async` and `await` macros are more to make things easier for me.
<FromGitter> <watzon> But I will be writing better docs in case anyone else wants to utilize it
<FromGitter> <watzon> Ok I need the help of someone that can help decipher a stack trace and figure out what's going on here. I'm getting a sigfault, and I've managed to narrow down the problem to one file, but I can't make heads or tails of this. ⏎ ⏎ https://github.com/protoncr/proton/blob/native/src/proton.cr has the example code that's causing the sigfault, the line that seems to actually be causing the problem is this one
<FromGitter> ... (https://github.com/protoncr/proton/blob/native/src/proton/network/request_state.cr#L9) which is just defining a property who's type is an abstract class. The abstract class in question has a whole ton of subclasses (you have to run `generate_types.sh` to generate them).
<FromGitter> <watzon> I thought I might be hitting some kind of limit with the number of subclasses an abstract class can have, but I generated a test file with 20000 subclasses and everything worked fine.
<FromGitter> <watzon> Here's the stack overflow itself https://del.dog/yrerfighib
<FromGitter> <watzon> It might be the hacky giant list of aliases I generate
_whitelogger has joined #crystal-lang
_ht has joined #crystal-lang
_whitelogger has joined #crystal-lang
<oprypin> watzon, what is this pile of dog. it's not even loading
<oprypin> > I've managed to narrow down the problem to one file
<oprypin> but it's not one file, it's requiring stuff.. what do you mean?
alexherbo2 has joined #crystal-lang
_whitelogger has joined #crystal-lang
<hightower2> Is there a particular data type I would be best off using if I needed to maintain a 3D (x,y,z) array of objects?
<oprypin> hightower2, 1 array could be ok
<jhass> question in this case is probably less what relationship the data has to each other but what kind of operations are needed or frequent on the structure
<jhass> does it need to be good at access, insertion, update, deletion? does it need to grow or can it be initialized with a static size? does it need to grow or shrink frequently?
<jhass> does it need to be good at swapping rows or colums? and so on
<hightower2> yeah good points. rarely grows/shrinks, but it is important that all Z objects at a particular (X,Y) are easily accessible
<raz> Hash(x,y) = Array(z)?
<oprypin> good idea
<raz> when unsure it's often good to just start out with the simplest thing that can possibly work™
<raz> and then optimize when structure & access patterns are clearer
<raz> (but obv that only makes sense when it can be done without rewriting the entire codebase a 2nd time ;))
f1reflyylmao has quit [Quit: bye fags]
f1refly has joined #crystal-lang
<hightower2> yeah the hash is not a bad idea, especially since the order of keys is guaranteed as well
gangstacat has quit [Quit: Ĝis!]
<hightower2> Can someone explain where the extra " " is coming from here: https://carc.in/#/r/a739
<hightower2> I expect the line to be: y=(arg) but it's y = (arg)
<jhass> I don't think y=(arg) would become a method call either?
<FromGitter> <Blacksmoke16> pretty sure for setters `y = 1` is equivalent to `y=1`
<jhass> you wanna prepend self.
<hightower2> yeah, just realized it after posting, fixed with self., thanks!
<hightower2> still it's strange
<jhass> it's just formatted
<hightower2> ah soo.. ok
gangstacat has joined #crystal-lang
<hightower2> jhass, is it possible to make the Def have access to it's doc? (node.doc)
<jhass> maybe? Nothing I know from the top of my head
<hightower2> In my case for example, when I do alias_method, I want to insert "Aliased names: #{list}" to the method's documentation
<hightower2> "compiler operates on doc mode" -- is this before or after the time 'macro finished' executes?
<FromGitter> <Blacksmoke16> its prob just building with `-Ddoc`
<FromGitter> <Blacksmoke16> or something like that
<FromGitter> <Blacksmoke16> but do you really have to create enough aliases to make a macro work it versus manually just doing like
<FromGitter> <Blacksmoke16> ```def x=(arg) ⏎ self.y = arg ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5fedec1fdbb17f28c5aedbea]
<hightower2> yes but this is not the issue, I'd still have the overhead of manually writing "# This method has aliases: <at least one>"
<FromGitter> <Blacksmoke16> so?
<hightower2> I don't wanna do it :)
<FromGitter> <Blacksmoke16> you would have been done by now if you ditched the macro :p
<hightower2> I'd maybe break even :) but the real payoff of a macro is I learned something while working on it ... can't beat that :)
<FromGitter> <Blacksmoke16> fair enough
<hightower2> ok, thanks, gonna figure out something else for the docs
alexherbo2 has quit [Ping timeout: 256 seconds]
deavmi has quit [Quit: No Ping reply in 180 seconds.]
deavmi has joined #crystal-lang
ua has quit [Ping timeout: 272 seconds]
deavmi has quit [Ping timeout: 260 seconds]
ua has joined #crystal-lang
deavmi has joined #crystal-lang
aquijoule__ has quit [Remote host closed the connection]
richbridger has joined #crystal-lang
hightower2 has quit [Ping timeout: 246 seconds]
richbridger has quit [Remote host closed the connection]
richbridger has joined #crystal-lang
richbridger has quit [Remote host closed the connection]
richbridger has joined #crystal-lang
hpyc9 has quit [Quit: 420]
hpyc9 has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
<FromGitter> <pebauer68> https://github.com/pebauer68/treehttps://crystalshards.xyz/?filter=tree ⏎ I wrote my first shard for crystal dynamic testing and hope it can be installed, i would appriciate some feedback
<sorcus> Happy New Year everyone ;-)
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
_ht has quit [Remote host closed the connection]
postmodern has joined #crystal-lang