<repo>
jhass: i installed the libvips package and wrote `require "gobject"` and `require_gobject "Vips"` but that fails: Typelib file for namespace 'Vips' (any version) not found (Exception)
<repo>
what am i missing?
sz0 has quit [Ping timeout: 240 seconds]
r0bby has quit [Read error: Connection reset by peer]
sz0 has joined #crystal-lang
r0bby has joined #crystal-lang
hightower3 has joined #crystal-lang
<jhass>
repo: well, doesn't look like libvips provides a .gir file
sz0 has quit [Read error: Connection reset by peer]
r0bby has quit [Read error: Connection reset by peer]
sz0 has joined #crystal-lang
r0bby has joined #crystal-lang
<repo>
jhass: yeah i figured :/
issyl0 has quit [Read error: Connection reset by peer]
issyl0 has joined #crystal-lang
alexherbo2 has joined #crystal-lang
sorcus has quit [Quit: WeeChat 3.0]
sorcus has joined #crystal-lang
xaxisx has joined #crystal-lang
<FromGitter>
<alexherbo2> hello
<FromGitter>
<alexherbo2> what is the Crystal equivalent of
<FromGitter>
<asterite> I think `head, *tail = exp` should just expand do `tmp = exp; head = exp[0]; tail = exp[1..]` and then we need to add the compiler logic so that you can index tuples with ranges at compile-time
<FromGitter>
<asterite> I wouldn't mind that at all. And then it would also work for arrays and other types too
<FromGitter>
<HertzDevil> we should avoid that, but the transformation is purely syntactic atm so it doesn't know whether `tup` is a tuple
<FromGitter>
<HertzDevil> or maybe it's okay anyway since the range cannot be a "conditionally" constant expression...?
<FromGitter>
<HertzDevil> the difference to single-element `#[]` is that one always returns something that's `<= Union(*T)` whether or not the indexer is a constant expression
HumanG33k has quit [Quit: Leaving]
<FromGitter>
<HertzDevil> here if you write out the full return type it becomes `Array(Union(*T))` and the union of O(n^2) tuple types
<FromGitter>
<HertzDevil> what if we rewrite constant range indexers to a distinct type 🤔
<FromGitter>
<asterite> Sorry, I don't understand what's the issue
HumanG33k has joined #crystal-lang
<FromGitter>
<asterite> if it's a range composed of integer literals, and that's passed to a tuple, then that's analyzed at compile time
<FromGitter>
<HertzDevil> so it's okay for `Tuple#[](Range)` to return an array or tuple depending on whether that range is a constant expression?
<FromGitter>
<HertzDevil> and even if it's okay for `Tuple` alone it might break things if `Indexable` gets the same overload in the future
<FromGitter>
<asterite> Yes, it's okay, at least in my mind
<FromGitter>
<asterite> if you have a tuple and index it with an integer literal, you get the type in that position
<FromGitter>
<asterite> if you do `x = 1` and index it by `x` you get the union of all types in the tuple
<FromGitter>
<asterite> possibly also raising if it's out of bounds
<FromGitter>
<asterite> other languages, like rust, have x.1, x.2, etc., to access a tuple to avoid this "confusion"
<FromGitter>
<asterite> I prefer a uniform and simpler syntax, or a smarter language
<FromGitter>
<asterite> Though as a beginning we could just have it work at compile-time for tuples, and if it's not a literal then error as usual
HumanG33k has quit [Read error: Connection reset by peer]
<FromGitter>
<jrei:matrix.org> I have an idea: I fork the project, then add a CI to schedule the script :)
<oprypin>
that ... is an amazing idea
<FromGitter>
<jrei:matrix.org> Of course the token will be a secret of the project.
<FromGitter>
<asterite> @HertzDevil Hehe, sorry. I guess by now you know the entire compiler :-D
<FromGitter>
<jrei:matrix.org> oprypin: do you mind I create a PR about adding the CI, so the procedure would be to fork the project and add a token to it?
<FromGitter>
<oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org): if you want you're welcome to. i can also do it myself quite quickly. let me know your preference
<FromGitter>
<jrei:matrix.org> If you can do it, you'll certainly do it faster & better than me 😅
<FromGitter>
<djberg96> is there an equivalent of `File.which` in Crystal somewhere?
<oprypin>
djberg96, Process.find_executable
<FromGitter>
<djberg96> excellent, thank you
xaxisx has quit [Quit: Leaving...]
straight-shoota has quit [Remote host closed the connection]
straight-shoota has joined #crystal-lang
<FromGitter>
<jrei:matrix.org> oprypin (https://matrix.to/#/@oprypin:matrix.org): awesome! Going to test it
<FromGitter>
<jrei:matrix.org> You were fast :o
alexherbo2 has quit [Remote host closed the connection]
_ht has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang
<raz>
hmm python is adding pattern matching
<raz>
shouldn't they at least finish their v3 transition first...
<FromGitter>
<oprypin:matrix.org> oh geez
<FromGitter>
<HertzDevil> > During failed pattern matches, some sub-patterns may succeed. For example, while matching the value `[0, 1, 2]` with the pattern `(0, x, 1)`, the sub-pattern `x` may succeed if the list elements are matched from left to right. The implementation may choose to either make persistent bindings for those partial matches or not.
<FromGitter>
<HertzDevil> it looks very python at least
<FromGitter>
<HertzDevil> the c++ pattern matching ts looks ugly
<FromGitter>
<HertzDevil> looked at java too and it only has a "limited form" that works with `instanceof`: https://openjdk.java.net/jeps/394
<FromGitter>
<HertzDevil> and it's something crystal does all the time (`is_a?` constrains a variable's type, even within a conditional)
<FromGitter>
<asterite> Yeah... I think Crystal was the first one to do this, and I think no other compiled languages "changes" the type of a variable (you have to use a different one)
<FromGitter>
<asterite> Well, sorbet does it too, for Ruby