RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.20.0 | Fund Crystals 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
mgarciaisaia has joined #crystal-lang
Fichtenstein has quit [Ping timeout: 252 seconds]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> aww yes it really works
<RX14> Papierkorb, ^
<RX14> uhh
<RX14> oh nvm
<Papierkorb> I assume it also works with `#read`?
<RX14> well
<RX14> not yet
<RX14> but thats only because I havent done the boilerplate
<RX14> get it working then get is usable
<RX14> :)
<RX14> it proves that it's possible
<RX14> at least
<Papierkorb> yeah, even with the boilerplate, the hard work is done
<RX14> took me a good few minutes to work out that tap doesn't work with structs
<Papierkorb> structs are pretty evil at times
<RX14> yeah
<RX14> eazy fix though
<RX14> 1 more line of code
<Papierkorb> It's more often than not easily visible if it will work or not, sadly, as there's no reference type like in C++
<RX14> hmm
<RX14> maybe I should have made resume token an integer then use hash
<RX14> we'll see what asterite thinks
<Papierkorb> a mapping Hash?
<Papierkorb> Sounds racey
<RX14> no
<RX14> Object#hash
<RX14> hmm
mgarciaisaia has quit [Ping timeout: 260 seconds]
<Papierkorb> If possible, maybe an abstract struct (or so) instead of Void* - or is the pointer size the culprit?
<RX14> the current select impl does allocate
<Papierkorb> To easily distinguish between incoming reads, whatever else, and the `gtfo` notification
<RX14> Papierkorb, well you need something thats really easy for every resume point to work out
<RX14> like
<RX14> your "token" needs to be unique to the object, and easilly worked out
<RX14> so that the resume point needs nothing more than the fiber handle
<RX14> otherwise you end up storing Deque(Fiber | Action) which is just messy
<RX14> I much prefer the resuming fiber just being logicless in that it always sets the resume token, without the knowledge that the resumed fiber will use it
mgarciaisaia has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<RX14> i'll probably need some sort of mask though to differentiate between receive or send on the same object
<Papierkorb> sure, simplicty above everything else. and I don't know your exact implementation, which makes it hard to reason about it too ;)
<RX14> well
<RX14> i'm committing it now
<RX14> maybe I should do it in the morning...
<Papierkorb> no need rushing it, these 10 hours won't change anything I guess
<RX14> sure
mgarciaisaia has quit [Ping timeout: 268 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has quit [Read error: Connection reset by peer]
akwiatkowski has joined #crystal-lang
<RX14> hmm
<RX14> these spedns are going to need some work
<RX14> specs*
<RX14> like reproducing a blocking write is hard
<RX14> you can set a pipe's buffer size
<RX14> but only to a minimum of 1 page
vikaton has joined #crystal-lang
bjz has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
<crystal-gh> [crystal] RX14 opened pull request #3595: [WIP] Generic Select for IO (master...feature/io-select) https://git.io/v1kZK
akwiatkowski has quit [Ping timeout: 264 seconds]
<RX14> Papierkorb, ^
<Papierkorb> neato
<RX14> well i guess i'll see how that turns out in the morning
<Papierkorb> Will take a look tomorrow too
hako has joined #crystal-lang
mgarciaisaia has quit [Read error: Connection reset by peer]
mgarciaisaia has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has quit [Read error: Connection reset by peer]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
mgarciaisaia has quit [Read error: Connection reset by peer]
mgarciaisaia has joined #crystal-lang
<FromGitter> <fridgerator> is something like this possible? https://gist.github.com/fridgerator/a90f9b720439d99b56eab2a5af37bb49
<FromGitter> <fridgerator> I want the instance of `Changeset` to hold a reference of the instance passed in
<FromGitter> <fridgerator> but `Changeset` is a library, so I don't know the instance types
<FromGitter> <fridgerator> it seems `@instance : Class` is too generic
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 246 seconds]
<FromGitter> <nilq> Anyone, for some reason, somewhy, want to help port some Python TCP server code?
mgarciaisaia has quit [Ping timeout: 246 seconds]
mgarciaisaia has joined #crystal-lang
soveran has quit [Read error: Connection reset by peer]
soveran has joined #crystal-lang
Philpax has joined #crystal-lang
shawn42 has quit [Quit: Connection closed for inactivity]
<FromGitter> <maiha_twitter> @fridgerator How about generic? https://gist.github.com/maiha/d39b48fa40d91002ee252cfe93bc2be2
<FromGitter> <fridgerator> ooh nice, let me try that
<FromGitter> <fridgerator> @maiha_twitter yep, works! thanks!
soveran has quit [Remote host closed the connection]
<FromGitter> <maiha_twitter> cheers! :)
Philpax has quit [Ping timeout: 246 seconds]
soveran has joined #crystal-lang
soveran has quit [Read error: Connection reset by peer]
soveran has joined #crystal-lang
_whitelogger has joined #crystal-lang
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 250 seconds]
soveran has quit [Remote host closed the connection]
mgarciaisaia has quit [Quit: Leaving.]
vikaton has quit [Quit: Connection closed for inactivity]
Philpax has joined #crystal-lang
<crystal-gh> [crystal] tbrand opened pull request #3596: Add '/bin/' into .gitignore (master...add-bin-into-gitignore) https://git.io/v1k0M
pawnbox has joined #crystal-lang
akwiatkowski has joined #crystal-lang
<mussela> BlaXpirit: are you around?
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
vivus-ignis has joined #crystal-lang
mussela has quit [Quit: Page closed]
<BlaXpirit> now i am
Fichtenstein has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 264 seconds]
Nik736 has joined #crystal-lang
mati_urunda has joined #crystal-lang
j2k has quit [Quit: Textual IRC Client: www.textualapp.com]
ome has joined #crystal-lang
<crystal-gh> [crystal] lbguilherme opened pull request #3597: [performance] Change Fiber.yield to not generate a timer event and instead just add itself as the last runnable fiber (master...patch-9) https://git.io/v1krl
<crystal-gh> [crystal] lbguilherme closed pull request #3597: [performance] Change Fiber.yield to not generate a timer event and instead just add itself as the last runnable fiber (master...patch-9) https://git.io/v1krl
hako has quit [Remote host closed the connection]
<Papierkorb> RX14: Could the pollfds and fdmap be recycled? That'd still malloc data, but chances are good I think that the same select is run in a loop by the fiber, so the array and hash would need the same size, thus no additional mallocs in subsequent select's
<Papierkorb> I like how much more flexible the whole `select` stuff is with that though. Also the rename of `(un)wait_for_x` to `activate_x` is a good one, much clearer what they actually do
vasilakisfil has joined #crystal-lang
<vasilakisfil> is this allowed? SUBDOMAIN = ENV["SUBDOMAIN"]
<vasilakisfil> because the value is not known compile time..
<vasilakisfil> I guess not..
ome has quit [Quit: Connection closed for inactivity]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v1kXM
<crystal-gh> crystal/master bbc348c taicsuzu: add bin
<FromGitter> <lbguilherme> @vasilakisfil it is totally allowed. constants don't have to be known at compile time
pawnbox has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
<travis-ci> crystal-lang/crystal#bbc348c (master - add bin): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/179202848
<FromGitter> <sdogruyol> I am not sure if it's for constants otherwise you can do that
vasilakisfil has quit [Ping timeout: 246 seconds]
Philpax has quit [Ping timeout: 260 seconds]
<RX14> Papierkorb, pollfds are structs so essentially free
<RX14> the cost of reusing a struct is probably greater than keeping it simple and just allocating it on the stack
x0f_ has joined #crystal-lang
x0f has quit [Ping timeout: 256 seconds]
x0f has joined #crystal-lang
<crystal-gh> [crystal] splattael opened pull request #3598: Prefer new `lib` path over old `libs` (master...swap-libs-search_path) https://git.io/v1ky9
hako has joined #crystal-lang
x0f_ has quit [Ping timeout: 258 seconds]
Fichtenstein has quit [Ping timeout: 250 seconds]
Fichtenstein has joined #crystal-lang
<Papierkorb> RX14: Was referring to the Array and Hash objects
<RX14> oh yeah sorry
<RX14> uhh i don't know if that would be particularly easy to cache
<RX14> how do you verify you have equivalent cations
<RX14> actions*
<RX14> i think that elimination would be the best route to go down at first
<Papierkorb> I only tried to avoid the malloc(), not the refilling of the array/hash. Though I'm not sure how expensive that even is
<RX14> then if we're sure that they can't be eliminated, then try to optimize by caching
<RX14> for example one route is to take the actions and perform a map to {action, pollfd?}
<RX14> which gets rid of the fdmap
<RX14> if actions is an array that'll malloc, but if it's a struct it won't
<Papierkorb> I'm wondering right now if the compiler can't create the maps
<RX14> for pollfds, we can just allocate an static-sized array with a good number of pollfds
<Papierkorb> even if filling them in is done later in the code. Or a StaticArray with a generous size, 32 or so. would limit the case count per select to that size
<RX14> i mean uninitialized Pollfd[100] or something
<RX14> then just switch on the 100 mark
<Papierkorb> I'm not even sure if that is needed, how likely is it to have that many cases in a single select?
<RX14> well
<RX14> it's 8 bytes per Pollfd
<RX14> 100 is only 800 bytes
<Papierkorb> Not saying against the 100 mark (or whatever number)
<Papierkorb> Was referring to > [16:22] <RX14> then just switch on the 100 mark
<RX14> yes but 800 bytes is tiny compared to L1
<Papierkorb> I read the `then just switch` as "fallback to a dynamically allocated data structure"
<RX14> L1 cache is 32KB plus just for data
<Papierkorb> I'm perfectly fine with that
<RX14> maybe 64 or 128 would be a more round aligned number
<Papierkorb> Now that I'm working on a small-ish tun/tap shard, I could also easily benchmark such code :P
<Papierkorb> We're on the same page that a single pollfd equals a single `when io` in the select statement, right?
<RX14> yes
<RX14> but it won't just be just select in code
<RX14> there's a reason select takes an array
<RX14> not just a struct
<RX14> there are cases when you do want to select on a large number of possible options
<RX14> sorry, tuple not struct
<RX14> select statement can't be dynamic size but select call can be
<Papierkorb> select as in IO#select ?
<Papierkorb> Which you thought about getting rid of?
<RX14> and replacing it with Select.select
<RX14> it's still a normal method call
<RX14> I ahve every reason to believe that Select.select will be widely used outside of generated code
<Papierkorb> as long it advocates using the statement version over the method version whenever possible in the docs, so people looking for `select()` find out about the statement version, and leave the method version for these cases where it's actually neede
<Papierkorb> d
<RX14> well yes raw select is a pain to use
<RX14> thats why the statement was introduced
<RX14> we had Channel.select in used for a long while before the select staement
<Papierkorb> Sure, I'm just saying the docs should make a reader aware of it
<Papierkorb> people new to crystal won't know about it
<crystal-gh> [crystal] asterite closed pull request #3598: Prefer new `lib` path over old `libs` (master...swap-libs-search_path) https://git.io/v1ky9
<Papierkorb> unrelated, is there anything against having `StaticArray#to_slice`? It's a pain to load a String into a lib struct's Char[x]
<BlaXpirit> Papierkorb, yeah it's not even only StaticArray. i very often run into missing to_slice
<BlaXpirit> as usual it's to_unsafe.to_slice(n)
<RX14> i'm sure static array has to_slice
<RX14> i'm sure i've used it
<RX14> yep
<RX14> Papierkorb, ^
<Papierkorb> Sometimes I'm wondering why I can't find such methods in the docs, when I'm looking at the docs
<RX14> ctrl-f?
<Papierkorb> I even find obscure stuff in the ruby docs, and they're awful in some places. I don't get it
<RX14> i mean it's not like it's hidden
RX14 has left #crystal-lang ["Leaving"]
RX14 has joined #crystal-lang
<RX14> it's too easy to ctrl-w an IRC channel in hexchat...
<Papierkorb> Then Use Konversation
BlaXpirit has left #crystal-lang ["Bye"]
<Papierkorb> Then use Konversation. It's as easy in there,.
BlaXpirit has joined #crystal-lang
<RX14> yes but thats made by kde
<BlaXpirit> because in konversation ctrl+w doesn't close the tab xD
<BlaXpirit> well at least you can change that
<Papierkorb> it does for me, and I didn't change that. But my settings file for konversation is old, they may have changed the defaults
<BlaXpirit> it's still ctrl+w by default for sure
<RX14> i still think hexchat is the best IRC client
<Papierkorb> And KDE is great. It sucks, but does so less for me than other DEs I tried.
<BlaXpirit> RX14, one of the worse ones i've seen
<RX14> how so?
<Yxhuvud> hexchat is like the only linux client that support dcc chat :/
<BlaXpirit> umm konversation?
<Papierkorb> I never tried, but Konversation seems to support it too
<Yxhuvud> /s/file/transfer
<Yxhuvud> erh.
<Papierkorb> that too
<RX14> i havent tried konversation but i've looked at screenshots and it looks ugly
<BlaXpirit> there is dcc file transfer in settings at least but who uses that anyway o_o
<Yxhuvud> I got core dumps last I tried.
<Papierkorb> I never tried, but I can send files through it
<BlaXpirit> RX14, it looks native
<RX14> yes but I don't use kde
<RX14> I use i3
<BlaXpirit> so...?
<RX14> so it's qt
<Papierkorb> Which is the best UI toolkit :P
<Papierkorb> Well, reducing Qt to that is harsh, it does so much more
<RX14> i've used hexchat all my life and it's always just worked
<RX14> and it looks nice https://aww.moe/si8bns.png
<BlaXpirit> that's the ugliest thing i've seen all day
<Papierkorb> That looks a lot like Konversation, although with a dark rather than light color theme
<Papierkorb> in the end, how much different could it look? It's IRC, not black magic
<travis-ci> crystal-lang/crystal#bea4fa6 (master - Prefer new `lib` path over old `libs`): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/179217809
<RX14> well most irc clients don't align usernames properly
<RX14> which is ugly to me
<Papierkorb> I'm more annoyed now that I didn't buy aww.moe back when it was free
<BlaXpirit> yep that's the one thing konversation doesnt do
<Papierkorb> eh, at least yay.moe is mine
<Papierkorb> free = available to buy
<RX14> lol
<RX14> i was surprized it was free too
hako has quit [Ping timeout: 260 seconds]
<RX14> it wasn't even more expensive
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v1kHW
<crystal-gh> crystal/master 84b0c6d Ary Borenszweig: Add pretty print
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v1kH8
<crystal-gh> crystal/master 36d0c36 Guilherme Bernal: Remove unneeded escapes from inline assembly
zacts has quit [Ping timeout: 245 seconds]
<travis-ci> crystal-lang/crystal#84b0c6d (master - Add pretty print): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/179221845
pawnbox has quit [Read error: Connection reset by peer]
pawnbox_ has joined #crystal-lang
<Papierkorb> I don't get it. Crystal suddenly doesn't set a value into a lib struct
<BlaXpirit> Papierkorb, chained dot access and assignment?
<Papierkorb> basically struct.union.value = 123
<BlaXpirit> yep
<Papierkorb> Worked fine yesterday
<BlaXpirit> that'll do it. or rather won't
<travis-ci> crystal-lang/crystal#36d0c36 (master - Remove unneeded escapes from inline assembly): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/179222067
<travis-ci> crystal-lang/crystal#36d0c36 (master - Remove unneeded escapes from inline assembly): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/179222067
hako has joined #crystal-lang
akwiatkowski has joined #crystal-lang
x0f_ has joined #crystal-lang
x0f has quit [Ping timeout: 250 seconds]
joshka has joined #crystal-lang
joshka has quit [Client Quit]
<Papierkorb> Are strings always stored with a NUL byte at the end?
x0f_ has quit [Ping timeout: 260 seconds]
<RX14> Papierkorb, yes
x0f has joined #crystal-lang
Fichtenstein has quit [Quit: Fichtenstein]
Fichtenstein has joined #crystal-lang
<FromGitter> <agibralter> is the IRC bridge to Gitter two-way?
<RX14> yes
<FromGitter> <agibralter> sweet
<FromGitter> <agibralter> anyone familiar with https://github.com/mosop/cli ?
<BlaXpirit> pls ask question :|
<BlaXpirit> probably not anyone familiar at the moment. i've ran into it but decided to reinvent the wheel instead
<FromGitter> <agibralter> I can't seem to get `error!` to actually set the status to non-zero. I was wondering if anyone else came across the same issue?
<FromGitter> <drosehn> Is there a way to declare an `@instance` variable such that it is initialized to `nil`, but after that it cannot be set to `nil`?
<BlaXpirit> drosehn, you can simulate that easily with 2 variables and make it seamless to the user
<FromGitter> <agibralter> Ok how about this one: what's the proper way to set the environment in Process.run ? Is it a hash?
<BlaXpirit> @was_set = false def get; @was_set ? @val : nil
<Papierkorb> drosehn, no, but have a look at the yielding version of the `property` macro instead
<BlaXpirit> agibralter, u can click through to this https://crystal-lang.org/api/0.20.0/Process/Env.html
<BlaXpirit> so yes, a hash
<Papierkorb> You may also like the `property!` version, depending on your use case
<FromGitter> <agibralter> @BlaXpirit thank you
<RX14> @drosehn, just use a raise-on-nil getter
<BlaXpirit> agibralter, i've been looking at mosop/cli and i dont see an obvious bug there. but it's possible that you have to handle the exit yourself..?
<RX14> or if possible ||=
<FromGitter> <drosehn> I was looking for versions of `property` yesterday, but couldn't seem to find the documentation for `property`.
<BlaXpirit> hm yeah, i went too complicated
<RX14> @drosehn ^
<FromGitter> <agibralter> @BlaXpirit hmm, I have `error!(help: true)` in my `def run`, and it's display the help text correct... the return code is `0` though. Not a big deal, but I was wondering why that's happening
<FromGitter> <drosehn> Thanks!
<FromGitter> <agibralter> Actually when I get a `Parsing Error` it still gives me `0`...
<BlaXpirit> agibralter, it never actually does anything with that status, just returns it as the result of .run
<FromGitter> <agibralter> oh, whoa—what's the proper way to return a status code to the user in Crystal?
<BlaXpirit> agibralter, https://crystal-lang.org/api/0.20.0/toplevel.html#exit%28status%3D0%29-class-method
<BlaXpirit> so use exit(Asdf.run(asdf))
<BlaXpirit> please check if this is documented in mosop/cli. if it's unclear, maybe make them an issue on github
<BlaXpirit> and let me know if i was actually correct, because i'm not sure :p
<FromGitter> <drosehn> a minor note: if I go to the API pages and use the "search" box to look for "property", no pages are matched.
<BlaXpirit> drosehn, i think it doesnt do such a smart search, just a search for class names
<FromGitter> <agibralter> @BlaXpirit thank you so much!
bjz has joined #crystal-lang
<FromGitter> <drosehn> well, mainly I wanted to show that I really did try... :smile:
<FromGitter> <drosehn> Thanks again.
<RX14> yeah there really should be a better search on the docs
<BlaXpirit> google :p
<BlaXpirit> well it certainly is possible to implement a static search index, like gitbook does it
<BlaXpirit> but it's such a mess and javascript :<
<FromGitter> <agibralter> https://github.com/mosop/cli/issues/4
<FromGitter> <agibralter> :smile:
<RX14> BlaXpirit, yes but I think it's totally worth it
<RX14> just being able to press a keyboard shortcut and fuzzy search everything would be fantastic
<BlaXpirit> docs are unwieldy enough as is :/
<BlaXpirit> i mean the implementation
Philpax has joined #crystal-lang
<RX14> well I don't think outputting an extra json file would be particularly hard
vivus-ignis has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
Raimondi has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
Philpax has quit [Ping timeout: 260 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Fichtenstein has quit [Ping timeout: 246 seconds]
A124 has quit [Ping timeout: 260 seconds]
<crystal-gh> [crystal] asterite pushed 3 new commits to master: https://git.io/v1ITI
<crystal-gh> crystal/master 579b429 Ary Borenszweig: Fixed #3580: crash on type declaration guessing
<crystal-gh> crystal/master 79c6127 Ary Borenszweig: Fixed #3594: "invalid UInt32: -1" when calling C function with wrong arguments
<crystal-gh> crystal/master 00f01f5 Ary Borenszweig: Disallow explicitly inheriting from Enum. Fixes #3592
akwiatkowski has quit [Ping timeout: 264 seconds]
bjz has joined #crystal-lang
Nik736 has quit [Quit: Textual IRC Client: www.textualapp.com]
<travis-ci> crystal-lang/crystal#579b429 (master - Fixed #3580: crash on type declaration guessing): The build has errored. https://travis-ci.org/crystal-lang/crystal/builds/179289338
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
Fichtenstein has joined #crystal-lang
Philpax has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
matp has quit [Remote host closed the connection]
soveran has quit [Remote host closed the connection]
matp has joined #crystal-lang
x0f_ has joined #crystal-lang
x0f has quit [Ping timeout: 248 seconds]
Fichtenstein has quit [Quit: Fichtenstein]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
Raimondi has quit [Quit: WeeChat 1.6-dev]
soveran has quit [Remote host closed the connection]