<splitty_>
Is it possible to place static arrays in .rodata?
<splitty_>
Also, what happens if an uninitialized static array goes out of scope?
<Papierkorb>
splitty_: No they can't, that's why I told you to use String
<splitty_>
When did you tell me to use String? o_O
<splitty_>
Do you mean the binary string stuff you talked about with Chronium?
<Papierkorb>
Oh yeah sorry
<Papierkorb>
Same nick colors in my client
<splitty_>
Ah I know that issue :P
<splitty_>
Sadly I can't do that in my situation. I need to have a StaticArray(Array(StackFrame* -> Nil))
<Papierkorb>
You're in a kernel too, right?
<splitty_>
Yep
<splitty_>
Setting up the interrupt handlers
<Papierkorb>
You have a GC?
<Papierkorb>
And a dynamic memory allocator in general?
<splitty_>
No `real` GC, but I have a GC implementation that uses the Heap to allocate memory
<Papierkorb>
That's not a GC
<splitty_>
So I can use malloc and such
<Papierkorb>
That's a allocator
<splitty_>
Well __crystal_malloc and that kinda stuff is in the gc/minimal.cr file in my kernel
<Papierkorb>
That's nice, doesn't make it a GC if it never automatically reclaims memory
<splitty_>
Yeah, I wanna get the basics done before writing a real GC
<Papierkorb>
Also you're overthinking that thing
<Papierkorb>
Just use a plain old, boring dispatcher, maybe with a macro to help out, which then handles the interrupt
<Papierkorb>
Having Procs flying around with an Array thrown into the mix held together by an StaticArray will do you no good atm
<Papierkorb>
I suggest dropping that.
mgarciaisaia1 has quit [Quit: Leaving.]
Kug3lis has joined #crystal-lang
Kug3lis is now known as Kug3lis_off
Yxhuvud has quit [Ping timeout: 265 seconds]
Yxhuvud has joined #crystal-lang
<FromGitter>
<jots_twitter> i just upgraded crystal and my program has kemal in my shard.yml. how do i force it to upgrade kemal? i changed the version number for crystal to 0.20.3
<FromGitter>
<jots_twitter> oh, just run `shards` it says it update kemal. but still i get the error `in lib/kemal/src/kemal/base_log_handler.cr:3: HTTP::Handler is not a class,` hmmm
<FromGitter>
<sdogruyol> Looks cool but I don't get the point
<FromGitter>
<sdogruyol> What's the difference between just using Spawn
pawnbox has joined #crystal-lang
<unshadow>
@sogruyol right now , not much except from the point that you can pre-decide how many concurrent jobs you want to execute. in the next version I'll add a queue managment for jobs waiting to be executed, and I hope that I can offer more options for the pool, dynamic grow, minimum-maximum fibers, spawn more fibers by need , etc..
vivus-ignis has joined #crystal-lang
mark_66 has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
<FromGitter>
<aeosynth> Error in src/main.cr:7: undefined method '[]' for Int32 (compile-time type is (Int32 | String)) ⏎ ⏎ puts cards[0]
<FromGitter>
<aeosynth> `cards` has the type `String` after line 2, but in the proc it has type `(Int32 | String)`
<FromGitter>
<aeosynth> `typeof` in the proc shows just `String`
<FromGitter>
<bcardiff> because a proc might be stored and executed later, not following the lexical order in the file. so the safe is to assume the type can change. In this case might be trivial, but in general that does not apply.
<FromGitter>
<redcodefinal> Hi guys, I'm working on a project that requires the use of a UInt24 and have been looking to write my own UInt24 class. However, when reading int.cr (https://github.com/crystal-lang/crystal/blob/798b2e228718d2c405d1a9f8c55e16a651d37fee/src/int.cr#L272) i noticed that there is the Int struct, and then Int8, Int16 etc etc as structs. However, Int8 etc etc dont have any link to the Int struct. How is it sharing methods?
<FromGitter>
<aeosynth> ok, but isn't `typeof` supposed to show the compile-time type? `puts typeof(cards)` doesn't show a union in the proc
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
matp_ has joined #crystal-lang
<BlaXpirit>
redcodefinal, it's hardcoded language magic
<BlaXpirit>
redcodefinal, `struct Int8 < Int` is maybe what you should do
<BlaXpirit>
and maybe you can find something like that in the language's source code in one of the spots
<BlaXpirit>
it's just that in other files it is not needed to specify the subclass again so they just write `struct Int8` to add more methods
<FromGitter>
<redcodefinal> @BlaXpiri @asterite does that mean it would be possible to add my own primitive ui24 as well? It's not necessary, just would be cool.
<RX14>
you couldn't add your own primitive UInt24
<RX14>
as that would require compiler support
<FromGitter>
<asterite> No, you'd need to modify the compiler for that
<RX14>
but you might be able to add a Int24 that wraps an Int32
<RX14>
why do you need an int24 anyway?
<crystal-gh>
[crystal] ysbaddaden opened pull request #3831: Always generate line numbers debug information (master...enhancement-add-line-numbers-to-all-builds-by-default) https://github.com/crystal-lang/crystal/pull/3831
<FromGitter>
<redcodefinal> @RX14 I'm writing an esoteric language that reads 24-bit bitmaps and uses them for instructions. I'
<RX14>
can't you just use an Int32 to store them?
<FromGitter>
<redcodefinal> yeah but i figured it could be done easier if there was a way to inherit from Int.
<FromGitter>
<bcardiff> @aeosynth it might be a bug then. the typeof(cards) should match the type the compiler think the variable is. (maybe I am underestimating some optimization in that snippet)
<FromGitter>
<redcodefinal> If i use an Int32 I have to A. Always be prepared to roll it over after every operation or B. Adapt every operation with a roll over check
<FromGitter>
<redcodefinal> Int already has all the methods defined why rewrite the wheel
<RX14>
i don't even know how well llvm support i24
_mtr has quit [Ping timeout: 246 seconds]
<RX14>
you would have to either implement an Int24 on top of an Int32 yourself or attempt to add Int24 support to the compiler
<FromGitter>
<redcodefinal> it's ok I'm guessing something like this can work?
<RX14>
this isn't easy if you want more than + - * / **
<RX14>
+ and * will need overflow checking when working with other UInt24s
<RX14>
- will need underflow checking
<RX14>
to act like it's underflowed 24bits instead of 32
<FromGitter>
<redcodefinal> yep before i had to write it into various part of the program, I was hoping I could write the overflow checking directly into the number this time
<RX14>
indeed you can
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<TheGillies>
any ETA for parallelization
<TheGillies>
is there branch for it?
<TheGillies>
a branch*
<RX14>
yes but it's inactive iirc
_mtr has joined #crystal-lang
<Papierkorb>
Would be amazing if lib structs would implement self.from_bytes
matp_ has quit [Remote host closed the connection]
matp has joined #crystal-lang
<RX14>
Papierkorb, might encourage people to pull structs containing pointers straight from untrusted inputs though
mgarciaisaia has quit [Quit: Leaving.]
<Papierkorb>
I don't think that many people are actually using IO#read_bytes, and I'd rather have a solid generic implementation for reading structures than having to cook my own all the time. A stern note in the docs should be enough that handling data is always risky
<RX14>
well
<RX14>
i know someone who was implementing some sort of binary mapping
<RX14>
i might get them to give me their code
<Papierkorb>
I have something for it in the torrent shard too
<Papierkorb>
mainly due to having to mess with the endianess :)
<RX14>
ideally there would be a binary mapping macro which implemented from_io and from_bytes
<Papierkorb>
Yep that's what I basically built there