ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | 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
duane has quit [Remote host closed the connection]
duane has joined #crystal-lang
DTZUZU has joined #crystal-lang
<FromGitter> <alexherbo2> what is the syntax for inner/outer variable name with rest?
<FromGitter> <alexherbo2> yes
<FromGitter> <alexherbo2> it seems not possible with rest
<FromGitter> <alexherbo2> I tried `*a *b` and the variants
<FromGitter> <alexherbo2> it could be possible to pass as an array with a named method?
<FromGitter> <alexherbo2> named argument*
<FromGitter> <Blacksmoke16> rest?
<FromGitter> <Blacksmoke16> you mean splats?
<FromGitter> <alexherbo2> yes
<FromGitter> <Blacksmoke16> guess not
<FromGitter> <Blacksmoke16> i cant see a reason to not support it via like `a *b` :shrug:
<FromGitter> <Blacksmoke16> maybe create an issue or it?
<FromGitter> <Blacksmoke16> raz you around?
alexherbo2 has quit [Ping timeout: 256 seconds]
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 246 seconds]
f1reflyylmao is now known as f1refly
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Ping timeout: 246 seconds]
chachasmooth has quit [Ping timeout: 246 seconds]
chachasmooth has joined #crystal-lang
<FromGitter> <HertzDevil> ~~better idea: add crystal support to godbolt's compiler explorer~~
<FromGitter> <HertzDevil> though i don't think their site is embeddable
teardown has quit [Ping timeout: 268 seconds]
<FromGitter> <HertzDevil> the union operator is partially commutative because `Crystal::Type#common_ancestor` isn't commutatively defined
<FromGitter> <HertzDevil> and that's what i'll work on today
<FromGitter> <HertzDevil> an example where this fails: https://play.crystal-lang.org/#/r/akf9
teardown has joined #crystal-lang
teardown has quit [Remote host closed the connection]
teardown has joined #crystal-lang
<FromGitter> <naqvis> 👍 👏
hendursaga has joined #crystal-lang
hendursa1 has quit [Ping timeout: 268 seconds]
straight- has joined #crystal-lang
straight-shoota has quit [Ping timeout: 240 seconds]
_ht has joined #crystal-lang
alexherbo2 has joined #crystal-lang
<jhass> @asterite @Blacksmoke16 @straight-shoota re. caching and "non-determinism", just consider "puts Time.local" :)
<jhass> so far we're at 2.5G DB size for 493k runs
<straight-> jhass, a simple solution would be to fix time like in the go playground :D
straight- has quit [Quit: ZNC 1.8.2 - https://znc.in]
straight- has joined #crystal-lang
straight- is now known as straight-shoota
<jhass> puts [1, 2].shuffle
<straight-shoota> Random can be fixed, too ;)
<straight-shoota> I don't think it's a really good idea, but it could do if necessary
<jhass> puts Time.measure { File.read("/etc/passwd") }
<FromGitter> <oprypin:matrix.org> am i missing something -- ⏎ you need to deduplicate only exact inputs and exact outputs. not the combination thereof
<FromGitter> <oprypin:matrix.org> which a good database does but itself anyway
oprypin_ is now known as oprypin
<straight-shoota> dedup helps reduce storage space. That should be relatively easy to implement without drawbacks because run results are immutable anyways.
<straight-shoota> The idea about caching is to reduce response time. If `puts "Hello World"` has been compiled and executed before, we could just return the previous result without doing that again
<straight-shoota> Only works for deterministic programs, though
<straight-shoota> Maybe caching the binary would be a middle ground. Takes more space, but chops off build time and works with non-deterministic runtime code
<straight-shoota> Still wouldn't work with `{{ `date` }}` but that might be acceptable
<straight-shoota> Or use AST with expanded macros as cache source. That would at least skip codegen.
yxhuvud has quit [Remote host closed the connection]
yxhuvud has joined #crystal-lang
<yxhuvud> heh. Signs the api you are working against may not be totally stable #1: You seriously consider upgading kernel version to see if the problem goes away. #2: It did go away after upgrading.
<FromGitter> <Blacksmoke16> gitter is not doing so great atm
DTZUZU_ is now known as DTZUZU
FromGitter has quit [Read error: Connection reset by peer]
hendursaga has quit [Remote host closed the connection]
hendursaga has joined #crystal-lang
johnny101 has joined #crystal-lang
_ht has quit [Remote host closed the connection]
teardown has quit [Remote host closed the connection]
teardown has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
teardown has quit [Remote host closed the connection]
teardown has joined #crystal-lang
FromGitter has joined #crystal-lang
<FromGitter> <asterite> Regarding carc.in, time and randomness:
<FromGitter> <asterite> You could consider initially consider an input as unknown regarding whether it will change over time. You keep a counter of how many times it gave the same result. If it reaches say, 10, you can consider that as always giving the same output. If it changes before that, you can consider it always needs to be run. It's not perfect, but it's a good approximation.
HumanG33k has joined #crystal-lang
<straight-shoota> yeah, I thought about that, too. But it doesn't work for things like `puts "Happy New Year" if Time.local.month == 1 && Time.local.day == 1`
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter> <asterite> But I'd say it's pretty contrived to have someone write exactly that same code. And the tutorial site could try to avoid those things :-). Also maybe if the source has Time on it, never cache it.
<FromGitter> <jrei:matrix.org> just cache default code samples
<FromGitter> <jrei:matrix.org> and don't save others
<straight-shoota> @jrei That might actually be the most practical solution
<straight-shoota> We could just let the client decide if a cached response is acceptable. The embedded playground would accept cached result if the code is unmodified
<straight-shoota> And demand actually running it if the code was edited. In that case chances of having the same edited content in multiple requests are low, anyways.
<straight-shoota> Developing this idea further, the execution could be entirely simulated for unmodified code, with the expected output already embedded in the HTML :D
<FromGitter> <jrei:matrix.org> you could implement as follow: have a hash of the code sample (client or server made), match this with (static) cached results. If not, compile this
<FromGitter> <Blacksmoke16> I'd also include the crystal version in the code hash
<FromGitter> <jrei:matrix.org> of course we make sure cached code samples will always return the same result
<FromGitter> <jrei:matrix.org> Don't know, does it matter for the client?
<FromGitter> <jrei:matrix.org> I mean, the server decide the Crystal version for the interactive code
<FromGitter> <Blacksmoke16> Ah I meant more so for the actual site, as you can select the version
<FromGitter> <asterite> Then also introduce a small delay in the server when the cached output is known, just to make it look a bit more real :-)