<alex``>
I have a loop, test input and output, and for each passed test, I check after that if the command is defined..
<alex``>
but I know already out of the loop if the command is defined or not
<alex``>
if would like to better express without `if cmd_same` check
<alex``>
with a single check I could do if (cmd_same) ... range.each, but I have multiple check in the loop, if input == output, if output.empty?, else
<FromGitter>
<dscottboggs_gitlab> could you provide a code example? It's kinda hard to read the examples you're posting through IRC
<FromGitter>
<dscottboggs_gitlab> I don't really understand the question yet
<FromGitter>
<dscottboggs_gitlab> not in my examples, because it's reassigned to a new variable whose type is `String` as opposed to `String?`
<alex``>
oh
<alex``>
I find your first solution more readable than the .try approach
<FromGitter>
<dscottboggs_gitlab> which doesn't give you a performance hit because that happens in the compiled assembly anyway
<FromGitter>
<dscottboggs_gitlab> I agree, the first example is how I usually do it
<FromGitter>
<dscottboggs_gitlab> I usually only use `.try` when I'm calling a single method on a value, i.e. `maybe_nil.try &.method || default`
<FromGitter>
<pynixwang> how to use a go lib in crystal?
<FromGitter>
<dscottboggs_gitlab> not possible. They're very easy to translate though.
<FromGitter>
<Blacksmoke16> id be surprised if you can?
<FromGitter>
<pynixwang> not possible?
<FromGitter>
<Blacksmoke16> cant be done
<alex``>
I want to set an initial input, using `input = if` statement, BUT in case of reading from stdin, I have to do an additional work (reopening tty), so I end up with `input = [] of String; if ... input = ...; else input = ...; additional-work`
<FromGitter>
<dscottboggs_gitlab> When I made crystal-darksky (https://github.com/dscottboggs/crystal-darksky), I copy-pasted large chunks of the golang (https://github.com/mlbright/darksky) implementation into Atom, and then used the split-cursor mode to edit all the lines at once. One could also do a simple regex replacement for large chunks of go source code to translate it to crystal structs
<alex``>
there is no functional way to assign `variable = if` ?
<alex``>
with extra-work in an if-else clause
<FromGitter>
<dscottboggs_gitlab> > not possible? ⏎ ⏎ No, seriously. The only way that we are able to bind to C code is because C has a standardized binary representation. Golang does not have this, and large chunks of its standard library are implemented in inline assembly. There is absolutely no way to bind go libraries to *any* other language.
<FromGitter>
<dscottboggs_gitlab> There is one library which generates C++ bindings, and it does so by generating a C file which calls the C++ functions, then binding to the C header.
<FromGitter>
<watzon> alex`` what do you mean by support language?
<FromGitter>
<watzon> Like a Crystal looking scripting language?
gangstacat has joined #crystal-lang
<FromGitter>
<nsuchy> @watzon What they're looking for is Ruby
<FromGitter>
<nsuchy> 😂
<FromGitter>
<watzon> Yeah, but until Crystal has a Ruby interpreter it's of limited use
<FromGitter>
<nsuchy> pretty sure given time, motivation, perhaps money and research time, a developer could create a RubyGem that creates domain specific language to use Crystal's syntax differences inside of Ruby without needing to change the Crystal code other than changing the file extension.
<FromGitter>
<nsuchy> @watzon Who said the entire program had to be written in Crystal
<FromGitter>
<nsuchy> I switch between Ruby and Crystal depending on the task all day long
<FromGitter>
<jirikivaari> I wish crystal would become almost drop-in placement for ruby
<FromGitter>
<jirikivaari> I think that way it might have the best future
<mistergibson>
no runtime env --> but one could perhaps be fashioned
<FromGitter>
<kinxer> Crystal isn't designed to be a drop-in replacement for Ruby. The syntax is based on Ruby's, but there design guidelines (e.g. to minimize duplicate methods for the same purpose) that break completely from a "compiled Ruby".
<FromGitter>
<straight-shoota> @kinxer In general, you're right. But reducing the amount of aliases is just a convention of Crystal's stdlib. You could easily implement a Ruby-compatible API for Crystal. There are however essential differences in the language itself (for example the type system) which makes any typical Ruby program incompatible with Crystal
<FromGitter>
<kinxer> @straight-shoota Oh, yeah. I only have an issue with assertions that Crystal itself needs to conform to a standard of interoperability with Ruby. Obviously people can make their own shards/projects for whatever.
<alex``>
watzon: support in the editor
<FromGitter>
<Blacksmoke16> sublime is pretty decent
<FromGitter>
<Blacksmoke16> formats on save, highlighting is pretty good
<FromGitter>
<Blacksmoke16> can get some info where stuff is defined on hover
<FromGitter>
<Blacksmoke16> deff not as expansive as like PHPStorm + PHP or RubyMine + Ruby but its workable
<FromGitter>
<nsuchy> @Blacksmoke16 You don't have to pay for sublime unless you want to use in a business. I don't want to cause problems for CrystalLang Moderators (Google is your friend y'all) but there are ways to disable the evaluation prompt, if its strictly personal/education use I don't see an ethical use as long as the projects aren't money generating.
<FromGitter>
<Blacksmoke16> i usually just hit cancel every time it pops up :P
<FromGitter>
<nsuchy> (Sorry to IRC Bridge users who I just spammed with edits)