ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.31.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <ImAHopelessDev_gitlab> WOW haskell's interactive tutorial is awesome
<FromGitter> <ImAHopelessDev_gitlab> on their website
<FromGitter> <ImAHopelessDev_gitlab> that's one of the coolest ways i've followed a tutorial, ever. damn that's fun. back to crystal though lmao
return0e has quit [Ping timeout: 265 seconds]
return0e has joined #crystal-lang
teardown has joined #crystal-lang
<FromGitter> <asterite> constants are kinda hoisted. They are actually lazily evaluated and cached the first time their value is used.
<FromGitter> <asterite> lbarasti: the value on the right side of a constant assignment has its own scope, it can't access variables outside of it. That's why your snippet fails to compile. This is different from Ruby
<FromGitter> <silasb> Why doesn't this compile: ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5dc221e53d669b28a041a6dd]
<FromGitter> <silasb> it seems like there should be enough type information to infer what the proc will accept.
<FromGitter> <tenebrousedge> maybe you mean `&->greet(String)` ?
<FromGitter> <tenebrousedge> what if there were another method with the signature `greet(context : Int32)` ?
<FromGitter> <silasb> it compiles with ⏎ ⏎ ```to(->greet(String))``` ⏎ ⏎ but I think it's redundant [https://gitter.im/crystal-lang/crystal?at=5dc222582a6494729ca5e0df]
<FromGitter> <tenebrousedge> methods can have the same name but accept different types
<FromGitter> <silasb> Good point.
<FromGitter> <silasb> It'd be nice if the compiler saw there was only one version and allowed that to go through, otherwise you end up with type annotation scattered around.
<FromGitter> <tenebrousedge> procs are always annoying / explicitly typed
<FromGitter> <tenebrousedge> it's at least consistently annoying
<FromGitter> <silasb> :P
<FromGitter> <christopherzimmerman> @kinxer thanks for the gist! That looks great, I'll have to integrate it
hightower3 has quit [Ping timeout: 240 seconds]
hightower2 has quit [Ping timeout: 240 seconds]
<FromGitter> <christopherzimmerman> Also small plug for Bottle (https://github.com/crystal-data/bottle). If anyone is interested in scientific computing I would love other contributors to form a core team of devs!
<FromGitter> <watzon> I'm wondering if anyone is using NixOS and if you've found that Crystal gives you any issues with the nonFHS compliant filesystem
<FromGitter> <watzon> I'm thinking about installing it soon, but I don't want it to screw up my workflow
<FromGitter> <ImAHopelessDev_gitlab> What OS are you currently on
<FromGitter> <watzon> Fedora
<FromGitter> <ImAHopelessDev_gitlab> nice
yukai has joined #crystal-lang
<yukai> hello, can anyone point me how to implement hash with generic covariance if its possible currently? https://play.crystal-lang.org/#/r/7ytb
<FromGitter> <watzon> Doesn't seem like it's possible currently, and I imagine there's a reason for it
<FromGitter> <tenebrousedge> it should be possible with a macro, shouldn't it?
<FromGitter> <watzon> This does work
<yukai> wow, thanks very much
<FromGitter> <tenebrousedge> can modules be used in type restrictions?
<FromGitter> <tenebrousedge> can I have a `Hash(String, Enumerable)` ?
<yukai> but yeah, Hash(String, A(Int32).class).new is a litle bit more restriction, than i wanted
<FromGitter> <tenebrousedge> (the answer is no)
<FromGitter> <tenebrousedge> yukai you might have to deal with a union
<yukai> yep, seems like it
<yukai> thanks
<FromGitter> <tenebrousedge> np
<FromGitter> <watzon> @tenebrousedge iirc yes
<FromGitter> <watzon> Modules should be able to work similarly to Interfaces in that way
<FromGitter> <tenebrousedge> not `Enumerable` though
<FromGitter> <tenebrousedge> because it's a (T)
<FromGitter> <tenebrousedge> yukai can you use a (non-generic) module instead of inheritance?
<yukai> i wanted to use inheritance specifically
<yukai> to imitate graphql-ruby class api for code-first schema construction
<yukai> i thout about a generic GraphQL::Object(O, C), where O is an object type and C is a context
<yukai> then i inherit from it like UserType < GraphQL::Object(DBUser, CurrentContext)
<FromGitter> <watzon> It works fine with `Enumerable` @tenebrousedge
<FromGitter> <watzon> https://carc.in/#/r/7ytp
<yukai> but for execution i need to construct a hash of this types(UserType, ShipType)
<FromGitter> <watzon> The rule though is you can only use Enumerable methods, since that's the type
<FromGitter> <tenebrousedge> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5dc2452410bd4128a1ca48fc]
<FromGitter> <watzon> Ahh yeah you can't use it in a Hash
<FromGitter> <watzon> Or an Array
<FromGitter> <watzon> But you can use it as a type in a method
<FromGitter> <watzon> I wonder, it says "yet". Does anyone know if and when it might be supported?
<yukai> there's a notation of SomeType+.class for covariance in compiler errors, but i cant specify this in code
<FromGitter> <tenebrousedge> I feel like there's some macro magic that would make this work
<FromGitter> <tenebrousedge> but I do not know it :(
<yukai> same feeling
<yukai> also there's couple of issues on generics currently open https://github.com/crystal-lang/crystal/issues/2665
<yukai> anyway, thanks
<yukai> i'll try macro path
_whitelogger has joined #crystal-lang
ht_ has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondi has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
yukai has quit [Ping timeout: 265 seconds]
<FromGitter> <ImAHopelessDev_gitlab> damn there is a lot of drama around godot's code of conduct, yikes
<FromGitter> <vlazar> isn't that what code of conduct is all about - a good drama? ;)
<FromGitter> <ImAHopelessDev_gitlab> ya ;D
<FromGitter> <ImAHopelessDev_gitlab> i've been more focused reading yt comments and reddit instead of actually coding... lmao
<FromGitter> <vlazar> that's why I usually just skip such "news", more time to actually do something
alexherbo2 has joined #crystal-lang
tdc has joined #crystal-lang
hightower4 has joined #crystal-lang
gangstacat has quit [Ping timeout: 252 seconds]
duane has quit [Ping timeout: 265 seconds]
gangstacat has joined #crystal-lang
<FromGitter> <cserb> Is this a bug when creating a Hash with a default value? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5dc2c82ca3f0b17849f93c9b]
<erdnaxeli> wow, it indeed looks like a bug
<FromGitter> <tenebrousedge> no, it's not a bug https://play.crystal-lang.org/#/r/7yvn
<FromGitter> <tenebrousedge> @cserb
<FromGitter> <tenebrousedge> hmmm
<FromGitter> <tenebrousedge> the `nil` thing is weird though
<FromGitter> <cserb> @tenebrousedge I did the "test" you added already in line 13-14
<FromGitter> <cserb> and that's not the problem
<FromGitter> <cserb> the "bug" is only when using `#[]?`
<FromGitter> <tenebrousedge> which internally calls `fetch(key, nil)`
<FromGitter> <tenebrousedge> which ignores the default
<FromGitter> <cserb> I think you are missing the point that the problem is when the key has a value not when the key has no value
<FromGitter> <tenebrousedge> did you click that link?
<FromGitter> <tenebrousedge> did you read the text on that line?
<FromGitter> <cserb> line 1038?
<FromGitter> <cserb> the weird part is that `pp bar["test']` return the value `[2]` which is *not* the default value (that would be `[]`), but on the other hand `pp bar["test"]?` returns `nil` while it should return `[2]`. And yes `pp bar["whaveter"]` should return `nil` but that's not the problem because it does that
<FromGitter> <tenebrousedge> it is the default value. You mutated the default value by inserting something into it
<FromGitter> <tenebrousedge> `<<` mutates its receiver
<hightower4> yeah, the default it returned to you wasn't a fresh default value assigned to your key, but the same object you'd get on any missing key
<FromGitter> <tenebrousedge> there's a difference between passing a default value and a default block
<hightower4> you used a non-existent key to gain access to, and mutate, the default object (as tenebrousedge says), rather than managing to define the value for this key
<FromGitter> <cserb> > *<hightower4>* you used a non-existent key to gain access to, and mutate, the default object (as tenebrousedge says), rather than managing to define the value for this key ⏎ ⏎ oh now I get!
<FromGitter> <Daniel-Worrall> Yeah, that's some bad practice since the default value is the same Array each time
<FromGitter> <Daniel-Worrall> The same thing happens in Ruby
<hightower4> it's funny though, this approach allows you to create a "hidden hash", doesn't it :) Like, if you define Hash x with default value of Hash.new, then accessing "x[somekey] = " would define key on real hash, while accessing "x[somekey].update(...)" would operate on the default/hidden hash :)
* FromGitter * tenebrousedge twitches
<FromGitter> <Daniel-Worrall> Hmm... Would anyone be interested in a `each_with_spawn` convenience?
<FromGitter> <Daniel-Worrall> Instead of doing ⏎ items.each |item| do ⏎ spawn do ⏎ ⏎ ```stuff``` ... [https://gitter.im/crystal-lang/crystal?at=5dc2d56310bd4128a1ce48d4]
<FromGitter> <Daniel-Worrall> It's too early. I really fucked up that syntax more than once
<FromGitter> <tenebrousedge> there isn't something like that already?
<FromGitter> <Daniel-Worrall> I don't think there is
<FromGitter> <tenebrousedge> that sounds strange
<FromGitter> <Daniel-Worrall> A browse in the docs doesn't yield anything, and neither does the concurrency guide
<FromGitter> <tenebrousedge> so it would do ⏎ ⏎ ```def spawn_each ⏎ each do |e| ⏎ spawn { yield e } ⏎ end ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5dc2d6689825bd6bac38e830]
<FromGitter> <tenebrousedge> ?
<FromGitter> <Daniel-Worrall> pretty much
<FromGitter> <Daniel-Worrall> I think `each_with_spawn` is more in line with other methods like `each_with_index`
<FromGitter> <tenebrousedge> but `spawn` is a verb and all the other things are nouns
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
alexherbo2 has joined #crystal-lang
alexherbo2 is now known as alex```
<FromGitter> <bararchy> @Daniel-Worrall what you want is basically the https://crystal-lang.org/api/master/toplevel.html#parallel(*jobs)-macro macro
<FromGitter> <Daniel-Worrall> Hmm, how would you suggest incorporating a list of values with this?
<FromGitter> <bararchy> Procs ? :)
alex``` has quit [Quit: The Lounge - https://thelounge.chat]
<FromGitter> <bararchy> but yeha, less nice
<FromGitter> <bararchy> @asterite so... Process and spawn ah? not good friends I guess
<FromGitter> <kinxer> @christopherzimmerman Would you please update the API docs at http://crystaldata.org?
<FromGitter> <kinxer> Also, the Bottle specs don't run.
<FromGitter> <christopherzimmerman> Yea, I haven't updated the tests since I switched to n-dimensional arrays, I'll update the api docs though.
<FromGitter> <christopherzimmerman> The API is *very* unstable right now, I feel like I re-write the entire thing every few days :), but definitely getting closer to what I want.
<FromGitter> <bararchy> what's crystaldata ? :)
<FromGitter> <bararchy> it seems to return no-acess
<FromGitter> <kinxer> Huh.
<FromGitter> <kinxer> http://crystaldata.org/bottle/
<FromGitter> <kinxer> ^ Outdated API, FYI.
<FromGitter> <christopherzimmerman> I really need to take those sites out of the README before I have a chance to set them up :P
<FromGitter> <bararchy> btw @christopherzimmerman where is the repo for it?
<FromGitter> <bararchy> oh found it https://github.com/crystal-data/bottle
<FromGitter> <bararchy> docs gives the wrong url
<FromGitter> <Daniel-Worrall> I can't think how procs would help
<FromGitter> <christopherzimmerman> https://crystal-data.github.io/bottle/ here is the up to date documentation
<FromGitter> <christopherzimmerman> All user facing methods are exposed in the `B` module, so if you just want an overview I would look at that
<FromGitter> <christopherzimmerman> That and the `Tensor` class are the meat of the library
<FromGitter> <bararchy> What are you aiming at with this lib?
<FromGitter> <bararchy> *shard* :)
<FromGitter> <bararchy> as in, future goal
<FromGitter> <christopherzimmerman> Ideally what `numpy` is for Python.
alexherbo2 has joined #crystal-lang
alexherbo2 is now known as alex```
<FromGitter> <bararchy> interesting :)
<FromGitter> <bararchy> we do need `Narray` in Crystal
<FromGitter> <bararchy> that's for sure
<FromGitter> <christopherzimmerman> I had looked at NArray, possibly to just use it with c-bindings. Based on its performance, I didn't see a reason to not just implement the array in crystal and let the compiler optimize things, kind of like how Julia handles it.
<FromGitter> <bararchy> Makes sense
<FromGitter> <bararchy> The more data science options we get in Crystal the better
ht_ has joined #crystal-lang
<FromGitter> <christopherzimmerman> Yea, data science tools really bring lots of people to the language, `pandas` brought a ton of people to Python from R.
<FromGitter> <Daniel-Worrall> Is there a docker tagged I can use to test my app with MT?
<FromGitter> <Blacksmoke16> pretty sure you can use nightly or latest and just pass the flag in when building your app
<FromGitter> <Daniel-Worrall> ah I thought I had to use crystal compiled specifically with MT
<FromGitter> <Blacksmoke16> naw
<FromGitter> <Blacksmoke16> its in there just behind a compiler flag
<FromGitter> <Daniel-Worrall> so I can probably just use my local crystal
<FromGitter> <Blacksmoke16> yes
<FromGitter> <Daniel-Worrall> what's the flag?
<FromGitter> <Daniel-Worrall> Since I have you here :^)
<FromGitter> <Blacksmoke16> `crystal run --release -Dpreview_mt my_app.cr`
<FromGitter> <Daniel-Worrall> does it have to be release?
<FromGitter> <Blacksmoke16> no
<FromGitter> <Blacksmoke16> but if you're benchmarking or something should have it
<FromGitter> <Daniel-Worrall> I just wanted to test speed/cpu by eye
<FromGitter> <Daniel-Worrall> Ah, so my C lib bindings aren't MT safe
<FromGitter> <Daniel-Worrall> (duktape)
<FromGitter> <Daniel-Worrall> I'd have to spin up new runtimes for each thing hmm
<FromGitter> <Daniel-Worrall> So I think I'll keep the module level class variable for the simplicity of `Beautify.js(content)`, but also add a Runtime Class with an instance mutex and allow Runtimes to be created on request with the same api, so `runtime = Beautify.js_runtime; runtime.js(content)
<FromGitter> <Daniel-Worrall> Should MT be supported at the lib level or app level?
<FromGitter> <Daniel-Worrall> cause I could let the user create their own mutex
<FromGitter> <Daniel-Worrall> OR I could add a macro to create a mutex on the MT flag
<FromGitter> <Daniel-Worrall> so single threaded don't have mutexes built in
<FromGitter> <bararchy> ^ איןד
<FromGitter> <bararchy> bla
<FromGitter> <bararchy> ^ this
<FromGitter> <bararchy> makes sure you protect your lib with Mutex
<FromGitter> <Daniel-Worrall> So flag for MT support at the lib level
<FromGitter> <bararchy> yeha
<FromGitter> <christopherzimmerman> @kinxer I worked a bit with the strategy pattern you suggested, was able to almost cut runtime in half with this approach (https://gist.github.com/christopherzimmerman/b8a556fa7fb32b2b4898f0e62e60c58c)
<FromGitter> <Daniel-Worrall> sweet, I'll do that from now on
<FromGitter> <bararchy> btw @christopherzimmerman have you seen SHAInet ?
<FromGitter> <Daniel-Worrall> Where do I see the Crystal core team
<FromGitter> <Daniel-Worrall> https://github.com/orgs/crystal-lang/people this I guess?
<FromGitter> <christopherzimmerman> I looked at that lib a bit, interesting for sure
<FromGitter> <bararchy> @Daniel-Worrall yeha
<FromGitter> <kinxer> @christopherzimmerman Looks good. There's a bit of code duplication (the strategy structs), but I'm glad you were able to improve your iterator speed.
<FromGitter> <kinxer> Ah, right. I see the difference now. That could probably be handled with a macro, though.
<FromGitter> <Blacksmoke16> mutex question since thats on topic atm
<FromGitter> <Blacksmoke16> say im using fibers for generating files
<FromGitter> <Blacksmoke16> like
<FromGitter> <Blacksmoke16> ```spawn do ⏎ generate_file_for_customer customer_id ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5dc30c2ae886fb5aa265f8d9]
<FromGitter> <Blacksmoke16> where that method looks up the user and builds/writes the file
<FromGitter> <Blacksmoke16> im assuming within that method i should do like ⏎ ⏎ ```mutex = Mutex.new ⏎ ⏎ mutex.synchronize do ⏎ ... ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5dc30c4a14d55a3785e73f16]
<FromGitter> <Daniel-Worrall> File.write is MT safe I believe
<FromGitter> <Blacksmoke16> more so was thinking for the db queries to get the data?
<FromGitter> <christopherzimmerman> @bararchy just noticed you're the primary contributor ha! How far do you think you are from GPU acceleration?
<FromGitter> <Daniel-Worrall> depends on the db query, method, and driver, since they support multiple connections ⏎ but, if they weren't, you'd only need to mutex.synchronize on the db lookups
<FromGitter> <Daniel-Worrall> io not being MT safe is breaking exception printing
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
<FromGitter> <asterite> what does MT at the lib or app level mean?
<FromGitter> <asterite> I mean, MT support
<FromGitter> <Daniel-Worrall> Having the lib introduce use mutex for calls instead of an app (user calling the lib)
<FromGitter> <Daniel-Worrall> Whether it's the libs responsibility or apps for missing
<FromGitter> <Daniel-Worrall> Mutex'ing*
<FromGitter> <asterite> Oh, I see. In Go it's a convention to say "this type is safe for concurrent use", and when nothing is said you can't assume it's safe. And I think it's always safe if the library provides MT safety. But it's not always possible.
<FromGitter> <Blacksmoke16> whats the equivalent to `$string1 ^ $string2` in crystal, from PHP?
<FromGitter> <Blacksmoke16> https://www.php.net/manual/en/language.operators.bitwise.php `If both operands for the &, | and ^ operators are strings, then the operation will be performed on the ASCII values of the characters that make up the strings`
<FromGitter> <Blacksmoke16> https://repl.it/repls/OptimalSilentKeyboardmapping full example
<FromGitter> <asterite> I think it's go to slice and then doing a zip of some sort
<FromGitter> <tenebrousedge> `str1.chars ^ str2.chars` maybe?
<FromGitter> <Blacksmoke16> `Error: undefined method '^' for Array(Char)`
<FromGitter> <tenebrousedge> really? huh
<FromGitter> <tenebrousedge> then `zip` I guess
<FromGitter> <asterite> @christopherzimmerman what numeric types do you use in your libraries? I always wonder what are good types in a statically typed language, unlike in python where ints are unbounded
<FromGitter> <tenebrousedge> `str1.each_char.zip(str2.each_char).map {|a,b| a ^ b }`
<FromGitter> <tenebrousedge> assuming that `Char#^` exists
<FromGitter> <tenebrousedge> otherwise use `ord` as appropriate
<FromGitter> <tenebrousedge> use `join` instead of `map` if the result needs to be a string
<FromGitter> <Blacksmoke16> hmm that seems to work but output is diff
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/7yxy
<FromGitter> <tenebrousedge> what is the output supposed to be?
rohitpaulk has joined #crystal-lang
<FromGitter> <Blacksmoke16> according to that repl and what i run locally `050705050705`
<FromGitter> <tenebrousedge> better? https://play.crystal-lang.org/#/r/7yxz
FromGitter has quit [Read error: Connection reset by peer]
FromGitter has joined #crystal-lang
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <Blacksmoke16> actually what if they are diff sizes
<FromGitter> <Blacksmoke16> nvm, they'll be the same size
<FromGitter> <christopherzimmerman> @asterite right now I support `Int32`, `Float64`, `Float32` and `Bool`. Since a lot of routines use BLAS and LAPACK, integer support is a bit limited. I also need to write my own Bool implementation that supports numerical operations, but that will be a ways away.
<FromGitter> <Blacksmoke16> @tenebrousedge i figured it out
<FromGitter> <Blacksmoke16> php pads its hex values
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/7yys
<FromGitter> <Blacksmoke16> while crystal omits the `0` if its not needed i guess
<FromGitter> <tenebrousedge> `each_char` is probably preferable
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <Blacksmoke16> thoughts on adding `String#^`?
<FromGitter> <Blacksmoke16> would make this a bit cleaner...
<FromGitter> <tenebrousedge> why should it be in core?
<FromGitter> <Blacksmoke16> idk, thats why i said "thoughts on" :P
<FromGitter> <tenebrousedge> should it behave like PHP in padding the digits?
<FromGitter> <Blacksmoke16> maybe have that be an option?
<FromGitter> <tenebrousedge> that the correct output isn't obvious is, to me, an argument against including it
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <asterite> what is the use case of that `^` thing?
<FromGitter> <Blacksmoke16> uh we use it to like generate a string id based on the id and salt of a record
<FromGitter> <Blacksmoke16> that could be tied back to the original id i guess
<FromGitter> <Blacksmoke16> idk much about it, messing around with porting some PHP to crystal and it was a thing i needed to do to remain BC
<FromGitter> <asterite> Hm, yeah, maybe xoring is fine by I don't know if I'd add that to the stdlib. A shard is good, though
<FromGitter> <Blacksmoke16> chances are ill never need it again so prob not a big deal either way ha
rohitpaulk has quit [Ping timeout: 265 seconds]
teardown has quit [Ping timeout: 264 seconds]
<FromGitter> <Daniel-Worrall> Does anyone know if there is a way to run Ruby code inside Crystal. For Javascript, I've used Duktape
<FromGitter> <tenebrousedge> I don't think so. It's possible to use Crystal libs in Ruby
<FromGitter> <Daniel-Worrall> Can't I use the Ruby C API?
<FromGitter> <Daniel-Worrall> I just don't know of projects that would simplify the process
<FromGitter> <tenebrousedge> You could but it would be painful
<FromGitter> <tenebrousedge> well, probably
<FromGitter> <tenebrousedge> Ruby is kinda a mess behind the scenes
<FromGitter> <Daniel-Worrall> I'm reading through https://silverhammermba.github.io/emberb/c/ *shrug*
<FromGitter> <tenebrousedge> yeah, that's my point of reference too 👀 I ran away scared
<FromGitter> <christopherzimmerman> Is there any way to have a variable number of arguments in a setter? so `a[1, 2, 3] = 10` and `a[1, 2] = 10` both calling the same method?
<FromGitter> <christopherzimmerman> I kind of doubt it because you can't have positional arguments after *args :(
<FromGitter> <Daniel-Worrall> so, I'm not too familiar with C. https://silverhammermba.github.io/emberb/embed/ ⏎ Would I need to write a C library and then write a Crystal binding to that C lib, or would I be able to write Crystal code to bind to the header file?
alex``` has quit [Quit: The Lounge - https://thelounge.chat]
<FromGitter> <christopherzimmerman> I know nothing about ruby, but ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ works just fine [https://gitter.im/crystal-lang/crystal?at=5dc33b18a03ae1584f7d84f1]
<FromGitter> <Fryguy> I think if you build Ruby with --enabled-shared, then you get a libruby.so file, which you can then link to. At that point, you create a Crystal lib based on the exported functions you want to link to. I'm not sure if Ruby exports its functions though
<FromGitter> <Fryguy> 1) --enable-shared
<FromGitter> <Fryguy> ruby-install and rbenv support this flag as well
<FromGitter> <Fryguy> or whatever rbenv uses... ruby-build?
<FromGitter> <asterite> @tenebrousedge Ugly but it works: https://play.crystal-lang.org/#/r/7yz4
<FromGitter> <tenebrousedge> @asterite what does that do? o__o
<FromGitter> <christopherzimmerman> Oh I think that was meant for me
<FromGitter> <tenebrousedge> I think you're right o__o
<FromGitter> <christopherzimmerman> I'm surprised, even if I mix types in args, the type of the last argument is still correctly inferred. My use case is closer to this (https://play.crystal-lang.org/#/r/7yz8)
<FromGitter> <christopherzimmerman> I would have expected a union type.
<FromGitter> <asterite> the thing is that splats are implemented as tuples, and tuples know what type is in each position
<FromGitter> <asterite> we designed it like that mainly to be able to forward method args, but from there a lot of benefits appeared (like this one)
<FromGitter> <asterite> though ideally you could slice a tuple with the regular syntax
ht_ has quit [Quit: ht_]
yukai has joined #crystal-lang
Human_G33k has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
HumanGeek has quit [Ping timeout: 240 seconds]