ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Fund Crystal's development: | GH: | Docs: | Gitter:
ur5us_ has joined #crystal-lang
ur5us_ is now known as ur5us
<FromGitter> <zhenfeng-zhu> does crystal have install command? like go install . or cargo install, so we can use bin in terminal.
<FromGitter> <Blacksmoke16> you can do `shards build` which would install and build the binaries defined in `shard.yml` if thats what you mean
<FromGitter> <Blacksmoke16> install dependencies that is*
<FromGitter> <zhenfeng-zhu> yeah, i mean it could build the binary file and then move it to $PATH.
<FromGitter> <Blacksmoke16> no, but could use a simple `Makefile` to do just that
<FromGitter> <Blacksmoke16> related:
<FromGitter> <Blacksmoke16> if you just have 1 binary you can do like `crystal build --release -o $HOME/bin/app src/`
<FromGitter> <zhenfeng-zhu> thanks~
<FromGitter> <zhenfeng-zhu> i mean we can install from a remote package.
<FromGitter> <Blacksmoke16> as an application you can use, or to add a dep to another project
<FromGitter> <zhenfeng-zhu> as an application we can use in terminal
<FromGitter> <Blacksmoke16> ah ok, in that case that's not what that issue was for
<FromGitter> <Blacksmoke16> was about*
<FromGitter> <zhenfeng-zhu> i will go to open an issue
<FromGitter> <Blacksmoke16> id maybe do a quick search first
<FromGitter> <Blacksmoke16> but pretty sure its going to be a no, given that's not really the purpose of shards. ideally you could take the binary from the release assets, or clone it, shards build, and copy the binary where ever you want
<FromGitter> <Blacksmoke16> but we shall see
<FromGitter> <Blacksmoke16> well there you go :P
<FromGitter> <zhenfeng-zhu> i found their discussions in this issue.
ur5us has quit [Ping timeout: 258 seconds]
ur5us has joined #crystal-lang
hightower2 has quit [Ping timeout: 260 seconds]
ua_ has quit [Ping timeout: 244 seconds]
ua_ has joined #crystal-lang
Chillfox has quit [Quit: Leaving]
casionaut has joined #crystal-lang
ur5us has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 264 seconds]
casionaut has quit [Remote host closed the connection]
wmoxam has quit [*.net *.split]
jhass|off has quit [*.net *.split]
pixel has quit [*.net *.split]
Peter0x44 has quit [*.net *.split]
peer has quit [*.net *.split]
spuun has quit [*.net *.split]
avane has quit [*.net *.split]
dannyAAM has quit [*.net *.split]
peer has joined #crystal-lang
jhass|off has joined #crystal-lang
wmoxam has joined #crystal-lang
Peter0x44 has joined #crystal-lang
pixel has joined #crystal-lang
spuun has joined #crystal-lang
dannyAAM has joined #crystal-lang
avane has joined #crystal-lang
Flipez4 has joined #crystal-lang
oprypin_ has joined #crystal-lang
jrayhawk_ has joined #crystal-lang
antoni has joined #crystal-lang
ua_ has quit [*.net *.split]
Flipez has quit [*.net *.split]
FromGitter has quit [*.net *.split]
oprypin has quit [*.net *.split]
antoszka has quit [*.net *.split]
mattt2 has quit [*.net *.split]
jrayhawk has quit [*.net *.split]
riza has quit [*.net *.split]
Flipez4 is now known as Flipez
Flipez has quit [Changing host]
Flipez has joined #crystal-lang
FromGitter has joined #crystal-lang
hightower2 has joined #crystal-lang
mattt2 has joined #crystal-lang
riza has joined #crystal-lang
ua_ has joined #crystal-lang
casionaut has joined #crystal-lang
<SamantazFox> straight-shoota: " Otherwise, just pin openssl to 1.1.1 in your alpine container" <- Alpine went back to 1.1 anyway because some packages still don't support 3.0 APIS
Guest39 has joined #crystal-lang
<Guest39> what does this line mean? `if something = something?`
<Guest39> i know what if is
<Guest39> i don't know what `=` is doing here
<Guest39> assignment?
<SamantazFox> Guest39: something? is to check that something exists (e.g a key in a Hash) and return nil if it doesn't
Guest39 has quit [Quit: Client closed]
<SamantazFox> Guest39: then, = effectively assigns a value
<SamantazFox> and the if finally checks that the variable (that was assigned) is not nil
<FromGitter> <Blacksmoke16> it's equivalent to ⏎ ⏎ ```temp = something? ⏎ ⏎ if temp ⏎ # temp is not nil ⏎ end``` []
<FromGitter> <Blacksmoke16> but shorter and more concise
Guest40 has joined #crystal-lang
<Guest40> for some reason i forgot that it returns nil and instead throws an exception. so i was confused from half an hour as to how an exception is being assigned to a variable instead of being thrown
<xyhuvud_> in this case we can also assume that something? returns a useful value if it is not nil.
<SamantazFox> Guest40: it's not Rust! Functions don't return exceptions.
<Guest40> the variable was defined using `property! name` and `name` throws exception whereas `name?` returns nil. i just forgot which was which and got confused.
Guest40 has quit [Quit: Client closed]
<SamantazFox> yes, but in any case, exceptions are not stored in anything. They interrupt the execution chain, and each function in the call chain is interrupted, until a rescue statement for that exception catches it.
<FromGitter> <Blacksmoke16> technically you could rescue an exception and assign it to a var to use later
<FromGitter> <Blacksmoke16> or ofc pass around an exception w/o raising it
riza is now known as groot
groot is now known as riza
riza is now known as groot
groot is now known as riza
<FromGitter> <darkstego> is there a way to get the bit-width of system using Macros?
<FromGitter> <darkstego> so at compile time
casionaut has quit [Quit: Leaving]
Flipez has quit [Read error: Connection reset by peer]
Flipez has joined #crystal-lang
Flipez has joined #crystal-lang
Flipez has quit [Changing host]
casionaut has joined #crystal-lang
<FromGitter> <darkstego> found it.. it is the flag? method in macros
<FromGitter> <Blacksmoke16> 🤔 that just checks for a given flag
<FromGitter> <Blacksmoke16> what flag are you using?
<FromGitter> <djberg96> anyone got a github action file for crystal I can crib? Mine appears to be busted
<FromGitter> <darkstego> x86_64
<FromGitter> <darkstego> I know that doesn't include all 64 bit architectures, but it is a start
<FromGitter> <Blacksmoke16> `bits64`
<FromGitter> <Blacksmoke16> prob want that one
<FromGitter> <darkstego> is that a flag?
<FromGitter> <Blacksmoke16> yes
<FromGitter> <Blacksmoke16> `flag? :bits64`
<FromGitter> <djberg96> @Blacksmoke16 thanks!
<FromGitter> <djberg96> is that the bitness of the host OS or the process?
<FromGitter> <Blacksmoke16> bits of the OS that is compiling a crystal program
<straight-shoota> It's the word size of the target architecture
<FromGitter> <maxfierke> there's a separate `host_flag?` macro for host flags if you need that (for bitness of the compiling machine, to @Blacksmoke16's point, if the two are different)
<FromGitter> <djberg96> 👍
taupiqueur has joined #crystal-lang
casionaut has quit [Quit: o7]
ur5us has joined #crystal-lang
<FromGitter> <claudiug> hello, 👋 to give myself another try, with crystal and ruby. was thinking to write a blank method in crystal and use it from ruby. I know that discouse has a fast_blank. now the question is: how can I write crystal code and ruby c code to create a ruby extension?
<FromGitter> <claudiug> any documentation
<FromGitter> <maxfierke> @claudiug are you asking about writing a Ruby extension *in* Crystal? or comparing it to a Ruby extension written in C?
<FromGitter> <claudiug> writing an ruby extension in crystal
<FromGitter> <claudiug> to be used in ruby
<FromGitter> <claudiug> normally in ruby, you using c and ruby headers to make some extension, was curious if that is possible using crystal
<FromGitter> <claudiug> I mean is possible from ruby to use FFI to call c libraries, but I prefer to make extension
<FromGitter> <claudiug> example, a lot of json libraries are written in c to be fast
<FromGitter> <claudiug> i found this
<FromGitter> <maxfierke> *in theory* one *could* write an extension for Ruby in Crystal (and maybe someone has tried) but I don't think it would be a particularly smooth path. You'd probably need to exclude the stdlib/runtime/gc pieces and write it only using code that doesn't require those (and probably write your own bindings for the Ruby C bits to emulate the Ruby extension header) or you could try using the full runtime but it'll
<FromGitter> ... come with a big size cost (and possibly weird runtime & GC behavior once you try to pass some pointers back and forth between the two worlds)
<FromGitter> <claudiug> thx for the info
<FromGitter> <Blacksmoke16> what are you wanting to do?
<FromGitter> <Blacksmoke16> that needs this*
<FromGitter> <maxfierke> There's also the other direction, embedding Ruby inside a Crystal program:
taupiqueur has quit [Ping timeout: 260 seconds]
<raz> that seems like planting a scooter engine into a ferrari
ur5us has quit [Ping timeout: 245 seconds]
Chillfox has joined #crystal-lang