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
<FromGitter> <renich_gitlab> OK. Thanks.
xybre has joined #crystal-lang
deavmi has quit [Ping timeout: 240 seconds]
deavmi has joined #crystal-lang
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 240 seconds]
<FromGitter> <HertzDevil> is it intentional that the external name of a parameter can be the empty string?
chachasmooth has quit [Ping timeout: 256 seconds]
chachasmooth has joined #crystal-lang
chachasmooth has quit [Ping timeout: 272 seconds]
chachasmooth has joined #crystal-lang
DTZUZU has quit [Quit: WeeChat 2.9]
DTZUZU has joined #crystal-lang
chachasmooth has quit [Ping timeout: 240 seconds]
chachasmooth has joined #crystal-lang
<FromGitter> <HertzDevil> ```p :"" # => :```
<FromGitter> <HertzDevil> welp
Stephanie has joined #crystal-lang
Stephie has quit [Ping timeout: 258 seconds]
<FromGitter> <oprypin:matrix.org> cuz the way to call it is probably `f(**{"": x})`
<FromGitter> <oprypin:matrix.org> maybe?? lol it's probably possible to call the function, even
<FromGitter> <oprypin:matrix.org> how did you create the external name?
asterite has quit [*.net *.split]
bougyman has quit [*.net *.split]
Flipez has quit [*.net *.split]
repo has quit [*.net *.split]
FromGitter has quit [*.net *.split]
chachasmooth has quit [*.net *.split]
riffraff169 has quit [*.net *.split]
jrayhawk has quit [*.net *.split]
coderobe has quit [*.net *.split]
justinmcp has quit [*.net *.split]
deavmi has quit [*.net *.split]
fifr has quit [*.net *.split]
badeball has quit [*.net *.split]
holst has quit [*.net *.split]
jhass has quit [*.net *.split]
DeBot has quit [*.net *.split]
bougyman has joined #crystal-lang
Flipez has joined #crystal-lang
FromGitter has joined #crystal-lang
asterite has joined #crystal-lang
repo has joined #crystal-lang
deavmi has joined #crystal-lang
badeball has joined #crystal-lang
fifr has joined #crystal-lang
holst has joined #crystal-lang
chachasmooth has joined #crystal-lang
riffraff169 has joined #crystal-lang
coderobe has joined #crystal-lang
justinmcp has joined #crystal-lang
jrayhawk has joined #crystal-lang
jhass has joined #crystal-lang
DeBot has joined #crystal-lang
jhass has quit [Max SendQ exceeded]
jhass has joined #crystal-lang
_ht has joined #crystal-lang
yxhuvud has quit [Remote host closed the connection]
<FromGitter> <HertzDevil> ```def f("" x) ⏎ p x ⏎ end ⏎ ⏎ f("": 1) # => 1``` [https://gitter.im/crystal-lang/crystal?at=6027a662a7fc4b573bd062cf]
<FromGitter> <HertzDevil> no splats needed
<FromGitter> <HertzDevil> however the crystal compiler relies on the external name (not internal) of the splat parameter being empty to determine whether that param can take any args
<FromGitter> <oprypin:matrix.org> oh that should be fixed
<FromGitter> <asterite> Probably an oversight but it's not clear to me what's the issue
<FromGitter> <oprypin:matrix.org> interesting, for `def f("" x); end` the doc signature that's generated is `def f(_ x) `
<FromGitter> <oprypin:matrix.org> @HertzDevil: but it's impossible for the splat arg to have an external name so it's fine
yxhuvud has joined #crystal-lang
<FromGitter> <oprypin:matrix.org> how to get an array `[1,1,2,2,4,4]` from an array `foo=[1,2,4]`
<FromGitter> <oprypin:matrix.org> `.flat_map { |x| [x, x] }`
<straight-shoota> Array.new(foo.size * 2) { |i| foo[i // 2] }
<FromGitter> <naqvis> ```foo.zip(foo).map(&.to_a).flatten```
<FromGitter> <oprypin:matrix.org> @naqvis: i think this is slightly worst than the example i already posted
<FromGitter> <oprypin:matrix.org> the other one is interesting for performance tho
<FromGitter> <naqvis> I thought intention was to seek different ways of doing the same thing :P
<straight-shoota> you could even get more performance with foo.unsafe_at(i // 2)
<FromGitter> <naqvis> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6027e02a726a881d4f712a1c]
<FromGitter> <oprypin:matrix.org> wow thanks ⏎ so nice to confirm my guess :D
<FromGitter> <jrei:matrix.org> I hate that yaml serialization changes whith new versions
<FromGitter> <Blacksmoke16> oh?
<FromGitter> <jrei:matrix.org> it highlights the fast that the yaml specification is complex, and not that robust
<FromGitter> <jrei:matrix.org> for instance, with 0.2.5 serializing nil returns "---\n" and on 0.2.2 `"--- \n"`
<FromGitter> <Blacksmoke16> ah you mean `libyaml`
<FromGitter> <jrei:matrix.org> libyaml version
<oprypin> that's on libyaml
<FromGitter> <jrei:matrix.org> indeed
<FromGitter> <oprypin:matrix.org> mhm `%r( )` regex literal doesnt work inside macros
<FromGitter> <erdnaxeli:cervoi.se> Hi, can I call a macro inside another macro?
<straight-shoota> sure
<FromGitter> <oprypin:matrix.org> erdnaxeli (https://matrix.to/#/@erdnaxeli:cervoi.se): you can *call* it but not use its """return value"""
<FromGitter> <Blacksmoke16> ^^
<FromGitter> <Blacksmoke16> i.e. "have another macro expand after the first"
<FromGitter> <erdnaxeli:cervoi.se> hmm
<FromGitter> <Blacksmoke16> related https://github.com/crystal-lang/crystal/issues/8835
<FromGitter> <erdnaxeli:cervoi.se> I want to do something like that: https://carc.in/#/r/aexb
<FromGitter> <erdnaxeli:cervoi.se> … which seems to work
<FromGitter> <Blacksmoke16> yes that the usecase that works fine
<FromGitter> <Blacksmoke16> the thing that issue is for is saw you have a somewhat complex macro you want to use in two other methods
<FromGitter> <Blacksmoke16> atm there isnt a way to keep your macros DRY, so need to duplicate everything
<FromGitter> <Blacksmoke16> say*
<FromGitter> <erdnaxeli:cervoi.se> but what I did allow me to DRY, no?
<FromGitter> <erdnaxeli:cervoi.se> I can use this one macro in many places
<FromGitter> <Blacksmoke16> https://carc.in/#/r/aexg i mean like this
<FromGitter> <erdnaxeli:cervoi.se> ok
<FromGitter> <erdnaxeli:cervoi.se> my usecase is simplier than that… so far :p
<FromGitter> <Blacksmoke16> like to share a value within a macro before it expands
<FromGitter> <Blacksmoke16> indeed
<FromGitter> <erdnaxeli:cervoi.se> ok, why this one does not work? https://carc.in/#/r/aexj
<FromGitter> <erdnaxeli:cervoi.se> it's like it doesn't get that "two" is a macro
<FromGitter> <Blacksmoke16> where are you defining the `Outside` type?
<FromGitter> <Blacksmoke16> did you mean `struct {{name.id}}`?
<FromGitter> <erdnaxeli:cervoi.se> oups, yes
<FromGitter> <erdnaxeli:cervoi.se> but I got the same error: https://carc.in/#/r/aexo
<FromGitter> <erdnaxeli:cervoi.se> just doing s/two/record/ works…
<FromGitter> <erdnaxeli:cervoi.se> ok found it, the inside argument was missing
<FromGitter> <Blacksmoke16> could just default it to `nil` or something
<FromGitter> <Blacksmoke16> and fwiw macros can use `{{yield}}`
<FromGitter> <Blacksmoke16> i.e. if you wanted to define methods within the type
<FromGitter> <erdnaxeli:cervoi.se> ok and now I have the same problem that in my actual code: https://carc.in/#/r/aexy works but https://carc.in/#/r/aexz does not
<FromGitter> <Blacksmoke16> you call macros like class methods
<FromGitter> <Blacksmoke16> `Test.two ...`
<FromGitter> <erdnaxeli:cervoi.se> ok I have to use Test.one inside two
<FromGitter> <Blacksmoke16> mmk
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/toplevel.html#record(name,*properties)-macro isnt this essentially what you want?
<FromGitter> <oprypin:matrix.org> aaaa webmock in specs is killing me
<FromGitter> <oprypin:matrix.org> i have `Spec.before_each do ⏎ WebMock.reset` ⏎ and yet, it doesn't reset
<FromGitter> <Blacksmoke16> if you add a `puts` or something, is it getting called?
<FromGitter> <oprypin:matrix.org> oh wtf i think it's this https://github.com/crystal-lang/crystal/issues/5094
<FromGitter> <oprypin:matrix.org> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
<FromGitter> <oprypin:matrix.org> how am i supposed to do scoped mocks
<FromGitter> <Blacksmoke16> but there are instance methods versions of those that are for a specific describe block
<FromGitter> <Blacksmoke16> i would have expected the class method version to be before *every* `it` block
<FromGitter> <Blacksmoke16> sure thats not the case?
<FromGitter> <oprypin:matrix.org> hm yea cannot reproduce https://carc.in/#/r/aey3
<FromGitter> <erdnaxeli:cervoi.se> @Blacksmoke16: in this example it looks like `record`, but actually I am doing more
<FromGitter> <Blacksmoke16> 👍 gotcha
<FromGitter> <erdnaxeli:cervoi.se> (sorry I was missing your message, my matrix client is kind of buggy)
<FromGitter> <erdnaxeli:cervoi.se> `{{yield}}` could actually help me a lot! I forgot about it but I already used it with `record`
<FromGitter> <Blacksmoke16> good to hear
<FromGitter> <oprypin:matrix.org> i need help
<FromGitter> <oprypin:matrix.org> https://github.com/oprypin/nightly.link/blob/123a1c5ab/spec/main_spec.cr ⏎ ⏎ why does this fail randomly?
<FromGitter> <oprypin:matrix.org> i have `Spec.before_each do WebMock.reset` and i check that it's called the same number of times as there are total examples
<FromGitter> <Blacksmoke16> is there a specific test that fails?
<FromGitter> <oprypin:matrix.org> @Blacksmoke16: no, --order=random and random fails
<FromGitter> <oprypin:matrix.org> `by_branch / ""` and `dash_by_branch / with .yml` pop up (almost?) always
<FromGitter> <jrei:matrix.org> hum you have 2 before_each
<FromGitter> <erdnaxeli:cervoi.se> funny that {{yield}} works if a block is provided or not (it actually helps)
<FromGitter> <Blacksmoke16> mhm
<FromGitter> <jrei:matrix.org> what's the diff between `before_each` and `Spec.before_each`
<FromGitter> <oprypin:matrix.org> i would also like to know whats the diff
<FromGitter> <Blacksmoke16> the latter is before every `it` block, while the former is scoped to the `describe`/`context` block it's used in
<FromGitter> <oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org): check out https://carc.in/#/r/aey6
<FromGitter> <jrei:matrix.org> ok!
<FromGitter> <jrei:matrix.org> so maybe the before_each does not work properly with random, don't know
<FromGitter> <oprypin:matrix.org> that... could be it
<FromGitter> <jrei:matrix.org> before_each will execute on all childs "it" and "describes" too I guess
<FromGitter> <oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org): no everything seems fine https://carc.in/#/r/aeyb
<FromGitter> <jrei:matrix.org> right
<FromGitter> <jrei:matrix.org> no idea then; how it's failing
<FromGitter> <Blacksmoke16> does it consistently fail when using the same random seed?
<FromGitter> <jrei:matrix.org> this add to execute once before all specs: https://github.com/oprypin/nightly.link/blob/123a1c5ab/spec/main_spec.cr#L477
<FromGitter> <jrei:matrix.org> (and below)
<FromGitter> <oprypin:matrix.org> yes
<FromGitter> <oprypin:matrix.org> that's quite a bad one but i'm sure it's not the cause
<FromGitter> <jrei:matrix.org> I'll clone locally to try things
<FromGitter> <jrei:matrix.org> ... ⏎ ⏎ > Error: Error opening file with mode 'r': 'style.css': No such file or directory
<FromGitter> <jrei:matrix.org> > In src/nightly_link.cr:622:25 ⏎ > ⏎ > 622 | ctx.response << {{read_file(path.id)}}
<FromGitter> <oprypin:matrix.org> have to run `make test` once first
<FromGitter> <jrei:matrix.org> my bad, I too used to `crystal spec` :)
<FromGitter> <oprypin:matrix.org> not your bad at all
<FromGitter> <jrei:matrix.org> I got no issues
<FromGitter> <jrei:matrix.org> I ran it, say 5 times
<FromGitter> <jrei:matrix.org> 20 times :)
<FromGitter> <oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org): um did u check out the particular commit
<FromGitter> <jrei:matrix.org> ha, miss it
<FromGitter> <jrei:matrix.org> got an error yes
<FromGitter> <jrei:matrix.org> I continue the discussion in PM
<FromGitter> <oprypin:matrix.org> it's really very simple - just because I *ever* stub a call to a different value, it fails
<FromGitter> <oprypin:matrix.org> *no problem whatsoever in Crystal, everything is good*
<FromGitter> <oprypin:matrix.org> just me being a dummy because my application has a cache and *it* chooses not to re-fetch the same url although webmock would've correctly stubbed it to a different value
<FromGitter> <oprypin:matrix.org> thanks j8r (https://matrix.to/#/@jrei:matrix.org) for help
<FromGitter> <oprypin:matrix.org> mm guess my strategy of pushing a binary from one archlinux to another isn't so rock-solid
<FromGitter> <oprypin:matrix.org> just got hit by a `/usr/lib/libc.so.6: version `GLIBC_2.33' not found`
FromGitter has quit [Remote host closed the connection]
oprypin has quit [Quit: Bye]
oprypin has joined #crystal-lang
FromGitter has joined #crystal-lang
<FromGitter> <Blacksmoke16> could just compile it statically first no?
<FromGitter> <oprypin:matrix.org> could i, though?
<FromGitter> <Blacksmoke16> built it in alpine linux via docker and tada
<FromGitter> <oprypin:matrix.org> 😩
<FromGitter> <oprypin:matrix.org> https://github.com/oprypin/nightly.link is my fastest growing (in stars) project :D ⏎ comparison graph (https://star-history.t9t.io/#oprypin/nightly.link&oprypin/crsfml&oprypin/sixcells&oprypin/crystal-chipmunk&oprypin/crystal-imgui&oprypin/install-crystal&oprypin/mkdocstrings-crystal)
teardown has joined #crystal-lang
<FromGitter> <jrei:matrix.org> oprypin (https://matrix.to/#/@oprypin:matrix.org): arch linux is not rock solid by essence
<FromGitter> <oprypin:matrix.org> yes it is 😠
<FromGitter> <jrei:matrix.org> even though the error is not related here
<FromGitter> <jrei:matrix.org> it is a rolling release distribution, things may breack
<FromGitter> <oprypin:matrix.org> anyway regarding the angry emoji - im joking ofc
<FromGitter> <jrei:matrix.org> I find Alpine KISSer than Arch :D
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU__ has joined #crystal-lang
DTZUZU__ is now known as DTZUZU
<FromGitter> <jrei:matrix.org> you could add a CD with GitHub Actions
DTZUZU_ has quit [Ping timeout: 265 seconds]
<FromGitter> <jrei:matrix.org> generate a new priv/pub SSH key, then a the private key as a secret
<FromGitter> <jrei:matrix.org> the static binary will be deployed automatically. If you like, you could even keep the service restart manual if you want more safety
<FromGitter> <oprypin:matrix.org> yeaaa i don't trust that
<FromGitter> <jrei:matrix.org> trust what?
<FromGitter> <oprypin:matrix.org> GitHub with my machine
<FromGitter> <jrei:matrix.org> trust GitHub to deploy a trustworthy binary, or working one?
<FromGitter> <oprypin:matrix.org> trust arbitrary access
<FromGitter> <jrei:matrix.org> you're afraid that it will send a "bad" binary?
<FromGitter> <jrei:matrix.org> because of course, it will only have this right
<FromGitter> <oprypin:matrix.org> it can literally do anything on my machine
<FromGitter> <oprypin:matrix.org> well with enough hardening it can be reasonable
<FromGitter> <oprypin:matrix.org> the service already runs as nobody
<FromGitter> <oprypin:matrix.org> but i don't care to risk
<FromGitter> <jrei:matrix.org> trusting docker hub building our image vs GitHub building our artifacts... close to the same
<FromGitter> <oprypin:matrix.org> well i don't trust docker hub so yes ... same
<FromGitter> <jrei:matrix.org> ideally you could build on 2 services and compare their hash
<FromGitter> <jrei:matrix.org> your service is not really security sensitive, being only available for already public repos?
<FromGitter> <oprypin:matrix.org> the point isn't my service but that the machine can be taken over
<FromGitter> <oprypin:matrix.org> also it does work with private repo's
<FromGitter> <jrei:matrix.org> As I said, of course you'll give it a user with no permissions other than writing to a directory
<FromGitter> <oprypin:matrix.org> im not confident in my ability to set this up right
<FromGitter> <jrei:matrix.org> fair enough, not that hard form what I've seen: only allow sftp acces to a dir
postmodern has joined #crystal-lang
_ht has quit [Read error: Connection reset by peer]
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
<FromGitter> <erdnaxeli:cervoi.se> is this a bug or a feature? https://carc.in/#/r/aeyk
<FromGitter> <erdnaxeli:cervoi.se> in case I am doing a library with `test`, I would think this is a bug. It means I have to write exhaustive testing to catch it.
<FromGitter> <Blacksmoke16> you're using exhaustive case so thats the expectation yes
<FromGitter> <erdnaxeli:cervoi.se> but my case in not exhaustive, the test for `D` is missing
<FromGitter> <Blacksmoke16> it works without the D type since unused types/methods are removed
<FromGitter> <Blacksmoke16> assuming its not used at all
<FromGitter> <erdnaxeli:cervoi.se> even if D is used, it still works: https://carc.in/#/r/aeyn
<FromGitter> <erdnaxeli:cervoi.se> it means my method is actually defined for Union(B, C), not A
<FromGitter> <erdnaxeli:cervoi.se> like if the type inference system has priority over my type anontation
<straight-shoota> what exactly would you expect?
<FromGitter> <erdnaxeli:cervoi.se> I would expect the compiler to tell me that my case is missing `A` and `D` conditions
<FromGitter> <erdnaxeli:cervoi.se> because I tell it that I want test to accept `A`, and my case is obviously wrong with that type of argument
<FromGitter> <Blacksmoke16> if i had to guess the compiler is smart enough to know the method *is* exhaustive based on all the invocations of the method
<FromGitter> <erdnaxeli:cervoi.se> yeah but I don't want that
<FromGitter> <erdnaxeli:cervoi.se> maybe someone will use my lib and write another invocation
<FromGitter> <erdnaxeli:cervoi.se> I know I can write a test for that, but that means I can't trust the compiler on that
<straight-shoota> type restrictions on method arguments don't work like that
<FromGitter> <Blacksmoke16> if the user creates another subtype it would also break down as you cant just add another `in` clause to the case
<straight-shoota> `def test(a : A)` makes sure that `a` matches the restriction `A`
<straight-shoota> but it doesn't cast the argument to that type
<FromGitter> <erdnaxeli:cervoi.se> Blacksmoke16: hmm indeed
<straight-shoota> you can cast to `A` explicitly using `a = a.as(A)`
<FromGitter> <erdnaxeli:cervoi.se> but then my case would only match `in A`, right?
<FromGitter> <erdnaxeli:cervoi.se> what I would like is the compiler to tell me "ok you want to accept any A, but your case isn't actually exhaustive with any A"
<FromGitter> <erdnaxeli:cervoi.se> there is still the case that Blacksmoke16 raised
<FromGitter> <Blacksmoke16> whats the exact usecase here?
<straight-shoota> yes, then you need to cover A as well
<FromGitter> <erdnaxeli:cervoi.se> I don't have tihs exact usecase actually, I was just testing the behavior of crystal and got suprised ^^"
<straight-shoota> you can't really do this
<straight-shoota> maybe with sealed types it could work
<FromGitter> <erdnaxeli:cervoi.se> my real use case will match the result of à from_json with use_json_discriminator, so I guess as it can actually return all the types, it will works as expected
<FromGitter> <erdnaxeli:cervoi.se> yeah but I understood sealed types are not a thing in crystal :p
<straight-shoota> maybe at some point...
<straight-shoota> I don't think it would work like you expect with deserialized values.
<straight-shoota> If the return type is something like B | C | D the compiler merges that to A+
<straight-shoota> so you would still have to cover `A` even if the parent type is never valid
<FromGitter> <erdnaxeli:cervoi.se> hmm
<FromGitter> <asterite> Sealed types strike again!
<FromGitter> <erdnaxeli:cervoi.se> what am I getting wrong here? https://carc.in/#/r/aeza
<FromGitter> <Blacksmoke16> drop the `JSON.`
<FromGitter> <Blacksmoke16> and actually `include JSON::Serializable`
<straight-shoota> @asterite to be honest, I'm not sure sealed types would be practical or actually improve anything for this use case
<FromGitter> <erdnaxeli:cervoi.se> yeah that was a test, it still complains about "Error: undefined method 'use_json_discriminator' for A.class"
<FromGitter> <erdnaxeli:cervoi.se> aaargh
<FromGitter> <erdnaxeli:cervoi.se> thanks Blacksmoke16
<FromGitter> <erdnaxeli:cervoi.se> so the case behavior change here: https://carc.in/#/r/aezh
<FromGitter> <erdnaxeli:cervoi.se> the case only see "A"
<FromGitter> <HertzDevil> like i said we should support devirtualized types in exhaustive cases
<FromGitter> <HertzDevil> but in the original example you still have to cover A and only A, because it isn't abstract
<FromGitter> <erdnaxeli:cervoi.se> right
_ht has quit [Remote host closed the connection]
<FromGitter> <jrei:matrix.org> I hope one day to have a restricted subset of Crystal which allows improved compile times
<oprypin> thats #nim
<FromGitter> <jrei:matrix.org> I don't really think it is, on the syntax POV
<FromGitter> <jrei:matrix.org> I find Crystal a bit easier to start with, because more procedural/less functional
<FromGitter> <asterite> I need to try nim again...
<FromGitter> <jrei:matrix.org> 1) 8k issues on Nim O.o
<FromGitter> <jrei:matrix.org> That's strange, perhaps they didn't clean them up
<FromGitter> <jrei:matrix.org> The language sounds simpler overall
<FromGitter> <oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org): haha no its surface is like 5x bigger
<FromGitter> <jrei:matrix.org> Ha? I looked at some code in the compiler
<FromGitter> <jrei:matrix.org> At least, the most used constructs are quite narrow there
<FromGitter> <jrei:matrix.org> A least, for proc, it is used in place of `def`, `Proc`, proc literal, and perhaps block, and maybe more
<FromGitter> <jrei:matrix.org> Their are lots of keywords by the way
<FromGitter> <asterite> j8r you should check how many open bugs Java or C# have :-) . Bug count only talks about language popularity
<FromGitter> <asterite> @HertzDevil yeah, devirtualizing types for sealed types is a good idea... but for example for the compiler it would maybe also be nice to say the hierarchy is sealed, but then the compile times go to the root... well, to the chimney I guess
<FromGitter> <jrei:matrix.org> Yeah, but what's strange Crystal lools more popular
<FromGitter> <HertzDevil> no it should be possible to use devirtualized types even for non-sealed types
<FromGitter> <asterite> How?
<FromGitter> <jrei:matrix.org> Crystal has more stars, but is younger, that may be a reason too
<FromGitter> <asterite> I think you mentioned that the compiler knows all types before checking exhaustiveness... but the point is that if you do `case ... in` with a hierarchy you are using and everything compiles fine... imagine this is a library. Someone using the library subclasses a type and suddenly the code in the lib doesn't compile anymore. The sealed annotation would be there to say "this is really not meant to be
<FromGitter> ... subclassed"
<FromGitter> <asterite> I don't think stars correlate to popularity
<FromGitter> <asterite> Otherwise we would almost be as popular as https://github.com/ruby/ruby
<FromGitter> <jrei:matrix.org> oprypin (https://matrix.to/#/@oprypin:matrix.org): so why you said nim if its surface is 5x bigger than Crystal? It can't be a subset 🤔
<FromGitter> <oprypin:matrix.org> it just has more features all over the place
<FromGitter> <oprypin:matrix.org> more you need to know about. and more to memorize because intuition won't help you
<FromGitter> <HertzDevil> but if it breaks it, well, breaks
<FromGitter> <HertzDevil> it happens to non-hierarchies too like that `TupleInstanceType::Index` i just added
<FromGitter> <HertzDevil> the only difference is where the error is reported
<FromGitter> <HertzDevil> you shouldn't need a sealed annotation at all for the devirtualized semantics
<FromGitter> <jrei:matrix.org> Nim and Crystal are close, Ruby a lot more
<FromGitter> <HertzDevil> https://play.crystal-lang.org/#/r/af0i
<FromGitter> <asterite> To realize how far we've come with intuitiveness in programming languages I recommend writing a real world application in Haskell :-)
<FromGitter> <Blacksmoke16> ```import Program ⏎ ⏎ Program.code``` [https://gitter.im/crystal-lang/crystal?at=60285983726a881d4f724a1a]
<FromGitter> <Blacksmoke16> :S
sagax has quit [Quit: Konversation terminated!]
<FromGitter> <alexherbo2> just learned with FileUtils about `extend self` in modules 🤯
<FromGitter> <alexherbo2> is there a shorthand to pass named arguments with the name of the variable, like in javascript?
<FromGitter> <asterite> Looking it that way it does seem very intuitive :-D
<FromGitter> <alexherbo2> `Process.run("mycomand", ["arg1"], input: input)`
<FromGitter> <alexherbo2> javascript can pass hashes like `{ command, args, input }`, instead of `{ command: command, args: args, input: input }`
<FromGitter> <Blacksmoke16> There isn't
<FromGitter> <HertzDevil> that sounds like a counterfeature
<FromGitter> <HertzDevil> at the same time it sounds like something you could do yourself with macros
<FromGitter> <oprypin:matrix.org> @HertzDevil: no it's a very good feature
<FromGitter> <oprypin:matrix.org> overall it can be even a benefit because it encourages you to use named args whereas otherwise you wouldn't bother writing it out
<FromGitter> <HertzDevil> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6028616147585464db784ef5]
<FromGitter> <HertzDevil> no need to be a language feature
<FromGitter> <oprypin:matrix.org> 😩
<FromGitter> <oprypin:matrix.org> @HertzDevil: how would u rewrite this line ⏎ https://github.com/oprypin/nightly.link/blob/27be4bb90ad2ff22e44b8275b23366f2120c2d78/src/nightly_link.cr#L156
<FromGitter> <HertzDevil> why
<FromGitter> <oprypin:matrix.org> so i dont freaking make a typo, thats why. because i did today, from all this copypasting
<FromGitter> <oprypin:matrix.org> `NightlyLink.gen_dash_by_branch(repo_owner: repo_owner, repo_name: repo_owner, workflow: workflow.rchop(".yml"), branch: branch)` ⏎ ⏎ oopsie woopsie
<FromGitter> <HertzDevil> except when that's also a legit use case and writing the short form produces a typo in the opposite direction
<FromGitter> <oprypin:matrix.org> crystal doesn't allow duplicate method args
<FromGitter> <Daniel-Worrall> The real answer is to do TDD and unit testing
<FromGitter> <HertzDevil> then you can do `**named(...)`
<FromGitter> <HertzDevil> making it a language feature means we have to invent new syntax rules for it
<FromGitter> <oprypin:matrix.org> who says we have to do anything
<FromGitter> <oprypin:matrix.org> you said ⏎ ⏎ > that sounds like a counterfeature
<FromGitter> <oprypin:matrix.org> and no, it isn't. arguing only that part
<FromGitter> <HertzDevil> i'm referring to "javascript overloading the `{...}` syntactic form to refer to this kind of objects" being a counterfeature in case i'm not clear
<FromGitter> <oprypin:matrix.org> me too
<FromGitter> <HertzDevil> you're suggesting it's a good feature, and i suggest it doesn't have to be a "feature" at the language level since the `named` macro does the same
<FromGitter> <HertzDevil> it's a good use case sure
<FromGitter> <HertzDevil> it could be a stdlib feature too (which i consider to be distinct from language features but some will disagree)
<FromGitter> <Daniel-Worrall> Nobody is talking about adding it to crystal, Hertz
<FromGitter> <Daniel-Worrall> It's a great feature, and good for javascript for having it
<FromGitter> <HertzDevil> and now i am
<FromGitter> <asterite> The other day I realized Ruby doesn't have any kind of syntax sugar, while Crystal and many other language have
<FromGitter> <HertzDevil> and i now claim that we shouldn't support that `{...}` short form in crystal whether or not it makes sense in javascript
<FromGitter> <oprypin:matrix.org> ruby doesnt have syntax sugar? what was `foo(x: y)` if not syntax sugar
<FromGitter> <asterite> Oh, you mean that it's a way to pass a Hash?
<FromGitter> <asterite> Yeah... Though in recent versions that might not be the case if the receiver has keyword arguments... No idea how that's implemented
<FromGitter> <asterite> But for example I proposed to add &.foo to Ruby and they didn't accept it because & is not an expression
<FromGitter> <asterite> In Crystal that's just syntax sugar for something you can write in a different way... And I don't think Ruby has a lot of that
<FromGitter> <oprypin:matrix.org> @HertzDevil: the macro substitute is going to be quite hindered by https://carc.in/#/r/af1f
<FromGitter> <oprypin:matrix.org> can write `f(x, y = 1 + 2, z)` though *hiss*