ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.20.3 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
ome has joined #crystal-lang
<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
Dreamer3 has joined #crystal-lang
<literal> how do I do this in Crystal? http://stackoverflow.com/a/18771769
<literal> if I try I can't declare def dynamically, or an error about "it" being a macro which doesn't allow string interpolation in its argument
<literal> s/try I/try I get/
<FromGitter> <jots_twitter> I have this in shard.yml: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ still kemal 0.17.2 is what it brings down when I do `shards` [https://gitter.im/crystal-lang/crystal?at=586b1316058ca96737be6998]
ssvb has joined #crystal-lang
Yxhuvud has quit [*.net *.split]
Kug3lis_off has quit [*.net *.split]
Philpax_ has quit [*.net *.split]
ssvb has quit [*.net *.split]
Philpax_ has joined #crystal-lang
Kug3lis_off has joined #crystal-lang
Yxhuvud has joined #crystal-lang
ssvb has joined #crystal-lang
<FromGitter> <jots_twitter> I had to remove shard.lock and then kemal updated
Chronium has quit [Read error: Connection reset by peer]
soveran has joined #crystal-lang
<crystal-gh> [crystal] MakeNowJust opened pull request #3826: Fix each* methods to return only nil (master...fix/each-return-nil) https://github.com/crystal-lang/crystal/pull/3826
<DeBot> https://github.com/crystal-lang/crystal/pull/3826 (Fix each* methods to return only nil)
soveran has quit [Ping timeout: 256 seconds]
pawnbox has joined #crystal-lang
<FromGitter> <f> Hello everyone!
<FromGitter> <f> Last night I updated crystalshards.xyz
<FromGitter> <f> Take a look :)
<FromGitter> <jots_twitter> @f been using it today. works great! thanks!
<FromGitter> <f> now the user space works better. -> crystalshards.xyz/github_username
<FromGitter> <f> e.g. crystalshards.xyz/f
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 256 seconds]
<FromGitter> <fridgerator> :thumbsup:
<FromGitter> <sdogruyol> @jots_twitter shards update is what you are looking for
lacour has quit [Quit: Leaving]
Kug3lis_off is now known as Kug3lis
Kug3lis is now known as Kug3lis_off
soveran has joined #crystal-lang
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
<unshadow> Hi, what do you guys think: https://github.com/bararchy/fiber_pool ?
<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]
pawnbox has joined #crystal-lang
Chronium has joined #crystal-lang
pawnbox has quit [Ping timeout: 248 seconds]
<TheGillies> alpha quality wrapper for libolm
<TheGillies> for matrix.org
<TheGillies> PRs welcome heh
unshadow has quit [Ping timeout: 256 seconds]
unshadow has joined #crystal-lang
<FromGitter> <jots_twitter> faster sort. someone add it to crystal's array :-) https://probablydance.com/2016/12/27/i-wrote-a-faster-sorting-algorithm/
pawnbox has joined #crystal-lang
gloscombe has joined #crystal-lang
pawnbox has quit [Ping timeout: 246 seconds]
vivus-ignis has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
vivus-ignis has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 246 seconds]
Dreamer3 has quit [Quit: Leaving...]
pawnbox has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
pawnbox has quit [Ping timeout: 246 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 246 seconds]
<crystal-gh> [crystal] ysbaddaden opened pull request #3827: Add Clock.monotonic for measuring elapsed time (master...feature-clock-monotonic) https://github.com/crystal-lang/crystal/pull/3827
<DeBot> https://github.com/crystal-lang/crystal/pull/3827 (Add Clock.monotonic for measuring elapsed time)
Yxhuvud has quit [Ping timeout: 256 seconds]
Kug3lis_off is now known as Kug3lis
Kug3lis is now known as Kug3lis_off
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
Yxhuvud has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox has quit [Ping timeout: 272 seconds]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 246 seconds]
vivus-ignis has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
vivus-ignis has joined #crystal-lang
Kug3lis has joined #crystal-lang
soveran has quit [Remote host closed the connection]
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Philpax_ has quit [Ping timeout: 246 seconds]
Kug3lis has joined #crystal-lang
vivus-ignis has quit [Ping timeout: 256 seconds]
<crystal-gh> [crystal] asterite closed pull request #3811: Atomic enum type (master...atomic-enum) https://github.com/crystal-lang/crystal/pull/3811
soveran has joined #crystal-lang
RX14 has quit [Quit: Fuck this shit, I'm out!]
RX14 has joined #crystal-lang
mark_66 has quit [Quit: Leaving.]
mark_66 has joined #crystal-lang
<travis-ci> crystal-lang/crystal#8aff8af (master - make enum type support atomic type): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/188502992
_whitelogger_ has joined #crystal-lang
kiliankoe has joined #crystal-lang
unshadow has quit [Ping timeout: 248 seconds]
vivus-ignis has joined #crystal-lang
vivus-ignis has quit [Remote host closed the connection]
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Kug3lis has joined #crystal-lang
unshadow has joined #crystal-lang
unshadow has quit [Ping timeout: 248 seconds]
unshadow has joined #crystal-lang
ome has quit [Quit: Connection closed for inactivity]
bjz_ has quit [Ping timeout: 258 seconds]
bjz has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
Chronium has quit [Ping timeout: 260 seconds]
Raimondi has quit [Read error: No route to host]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
binBASH has quit [*.net *.split]
literal has quit [*.net *.split]
literal has joined #crystal-lang
Kug3lis has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<crystal-gh> [crystal] ysbaddaden opened pull request #3830: Add Enum.each and Enum#each (master...feature-enums-each) https://github.com/crystal-lang/crystal/pull/3830
<DeBot> https://github.com/crystal-lang/crystal/pull/3830 (Add Enum.each and Enum#each)
damireh has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
damireh has quit [Quit: Textual IRC Client: www.textualapp.com]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
stnly has quit [Ping timeout: 258 seconds]
stnly has joined #crystal-lang
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <sdogruyol> @RX14 seems like multipart.cr is broken on 0.20.3
pawnbox has quit [Remote host closed the connection]
Kug3lis has joined #crystal-lang
pawnbox has joined #crystal-lang
<FromGitter> <sdogruyol> @RX14 this work on Crystal 0.20.1 and Kemal 0.17.3 yet fails on 0.20.3 / 0.17.4
<FromGitter> <sdogruyol> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=586bc3d0058ca96737c1e5fc]
<FromGitter> <sdogruyol> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=586bc3daaa6be0472f00e17e]
binBASH has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
Kug3lis has quit [Ping timeout: 246 seconds]
mark_66 has quit [Quit: Leaving.]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has quit [Remote host closed the connection]
unshadow has quit [Quit: leaving]
Kug3lis has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
Raimondi has joined #crystal-lang
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DeBot has quit [Remote host closed the connection]
DeBot has joined #crystal-lang
<Papierkorb> Is it possible to group methods through in-source docs?
<Papierkorb> Like doxygens @begingroup @endgroup (iirc they were called that) directives
<RX14> no, but you should propose that idea
unshadow has joined #crystal-lang
<unshadow> Is there a way to know if a Fiber is alive ? can a Fiber even die ?
<havenwood> >> require 'fiber'; Fiber.new {}.alive?
<DeBot> havenwood: Syntax error in eval:21: unterminated char literal, use double quotes for strings - https://carc.in/#/r/1iz5
<havenwood> unshadow: If you `require 'fiber'` you'll get additional methods including #alive?
<unshadow> Oh, that's cool ! havenwood where is the alive comes from ? it's not in the API
<unshadow> havenwood: seems it's not working ? https://play.crystal-lang.org/#/r/1iz6
<havenwood> unshadow: I didn't realize what channel I was in. My mistake, sorry! I'm just confused. Never mind me.
<unshadow> hahah havenwood :) no worries
snapcase has joined #crystal-lang
<unshadow> Does this crashes because Crystal does not officelly supports threads ? https://play.crystal-lang.org/#/r/1izk
<Papierkorb> If run outside the play environment, it may crash cause a system may refuse to allocate 50k threads
<RX14> unshadow, 50000 threads is a crazy amount
<BlaXpirit> unshadow, it crashes because of sandboxing in carc in
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<BlaXpirit> also threads seem to take very long to spin up
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
aeosynth has joined #crystal-lang
gloscombe has quit [Remote host closed the connection]
Kug3lis_off is now known as Kug3lis
Kug3lis has quit [Quit: Textual IRC Client: www.textualapp.com]
soveran_ has joined #crystal-lang
soveran has quit [Ping timeout: 245 seconds]
soveran_ has quit [Remote host closed the connection]
aeosynth has quit []
_mtr has joined #crystal-lang
_mtr has quit [Ping timeout: 256 seconds]
_mtr has joined #crystal-lang
_mtr_ has joined #crystal-lang
_mtr has quit [Read error: Connection reset by peer]
_whitelogger has joined #crystal-lang
braidn[m] has joined #crystal-lang
Raimondii has joined #crystal-lang
bjz has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
<FromGitter> <aeosynth> why does using a proc change my type? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=586c01c2058ca96737c373d9]
<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.
_mtr has joined #crystal-lang
<FromGitter> <bcardiff> think of ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=586c0339aa6be0472f0277e6]
_mtr_ has quit [Ping timeout: 246 seconds]
<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
soveran has quit [Ping timeout: 246 seconds]
matp has quit [Ping timeout: 246 seconds]
<RX14> well the original definition is defined to inherit from int
<RX14> so i would assume that any further definitions would compile error when reopening if the definition isn't the same
<RX14> but thats clearly not happening here
<RX14> https://carc.in/#/r/1izs imho this shouldn't compile
<RX14> same as this https://carc.in/#/r/1izu
<RX14> https://carc.in/#/r/1izw it works, but still
<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
<DeBot> https://github.com/crystal-lang/crystal/pull/3831 (Always generate line numbers debug information)
<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?
<FromGitter> <redcodefinal> ```struct UInt24 < UInt32 ⏎ MIN = 0 ⏎ MAX = 0x100000 ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=586c082b9e6f00e74af2090f]
<RX14> you can implement your own int types, and it does work, as shown by BigInt
<RX14> i would be extremely surprized if inheriting Int32 works
<RX14> and that would not implement 24-bit behaviour
<FromGitter> <redcodefinal> well in all reality all I really want are the operations (+, -, *, /, **, etc)
<FromGitter> <redcodefinal> Hmm yeah it doesnt let me inherit UInt32 :<
<RX14> good
<FromGitter> <redcodefinal> @RX14 ok I figured it out https://play.crystal-lang.org/#/r/1j02
<FromGitter> <redcodefinal> shoot
<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
<Papierkorb> Maybe I could make it more generic
<RX14> maxpowa, ping
<maxpowa> yo
bjz has joined #crystal-lang
vivus-ignis has joined #crystal-lang
<maxpowa> o check that out, papierkorb's is way cleaner than mine lol
<maxpowa> but it only works for int types
<maxpowa> u/int
<RX14> there should probably be a from_bytes generated too maxpowa
<maxpowa> yeah
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
vivus-ignis has quit [Ping timeout: 246 seconds]
soveran has quit [Remote host closed the connection]
<FromGitter> <Givralix> hello, i was wondering if there was a way to make a crystal program stop before reaching the end of it?
<RX14> exit
<RX14> it's just a top-level method
<RX14> takes an optional exit code
<FromGitter> <Givralix> thank you a lot !
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
_mtr has quit [Ping timeout: 246 seconds]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has quit [Ping timeout: 272 seconds]
Philpax_ has joined #crystal-lang