<FromGitter>
<vusaalab> what is the best way to call command console , do i want to user process?
<FromGitter>
<dscottboggs_gitlab> what
<FromGitter>
<codenoid> backtick (?)
<FromGitter>
<vusaalab> yes
<FromGitter>
<bararchy> @Sija listening to Metal doesn't mean one is childish. There are a lot of bands out there with much more adult minded lyrics then "fuck the system", take a look at 'tool' for example , listen to 'sober' or 'parabole' those are amazing songs which are metal genere but aim at much deeper topics. Also, another favorite of mine is " mars red sky - arcedia"
<FromGitter>
<vusaalab> io = MemoryIO.new ⏎ Process.run(command, shell: true, output: io) may be this will work
<FromGitter>
<codenoid> yes
<FromGitter>
<codenoid> so you want read process stdout
<FromGitter>
<codenoid> ok
<FromGitter>
<dscottboggs_gitlab> isn't there a Process.run "command" { |io| ... } ?
<FromGitter>
<dscottboggs_gitlab> the problem with backticks is there's no stderr/exit code.
<FromGitter>
<vusaalab> Thanks yes this will works
<FromGitter>
<codenoid> heavy metal - high octane band
shmibs has joined #crystal-lang
DTZUZO has quit [Ping timeout: 260 seconds]
<FromGitter>
<vusaalab> why i am getting this error, undefined method '[]' for JSON::Any.class (compile-time type is (JSON::Any | JSON::Any.class))
<FromGitter>
<vusaalab> @metadata[:stream]
moei has quit [Ping timeout: 252 seconds]
<FromGitter>
<fusillicode_twitter> Hi guys, sorry as always for the bother, quick question. Is there a way to get the name of the method when you're inside it? I couldn't find anything aside from `self.class` 🤔
ashirase has quit [Ping timeout: 245 seconds]
ashirase has joined #crystal-lang
<FromGitter>
<j8r> That's a strange question, why do you need this?
<FromGitter>
<j8r> Perhaps with macros it's possible, don't know
<FromGitter>
<fusillicode_twitter> Well I would like to log something inside an object instance method and considering that `self.class` is available I was wondering if there was something similar for methods :)
<FromGitter>
<fusillicode_twitter> jftr the first problem was related to the type inference that wasn't able to properly infer the one line conditional I had before these 3 lines: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5baf43c4ef4afc4f28f15bad]
<FromGitter>
<fusillicode_twitter> the second one was related to uninitialized arrays (i.e. Array(Tuple(String, JSON::Any))) for the new hashes keys and I had it solved with an explicit check: ⏎ `acc[prop1] = Array(Tuple(String, JSON::Any)).new unless acc.has_key?(prop1)`
<FromGitter>
<vusaalab> @vusaalab ⏎ why i am getting this error, undefined method '[]' for JSON::Any.class (compile-time type is (JSON::Any | JSON::Any.class)) ⏎ @metadata[:stream]
<FromGitter>
<vusaalab> @r00ster91 thanks it works @metadata["streams"]?
Raimondii has joined #crystal-lang
tilpner_ has joined #crystal-lang
davic has quit [Ping timeout: 240 seconds]
ashirase has quit [Ping timeout: 240 seconds]
johndescs has quit [Ping timeout: 240 seconds]
Raimondi has quit [Ping timeout: 240 seconds]
tilpner has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
tilpner_ is now known as tilpner
johndescs has joined #crystal-lang
davic has joined #crystal-lang
moei has joined #crystal-lang
ashirase has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
Tortice has joined #crystal-lang
<Tortice>
$ ls /usr/lib/lib{pcre,gc,event}.so works for me, but --linker-flags="-static" says ld can't find them
moei has quit [Ping timeout: 252 seconds]
<FromGitter>
<Sija> @bararchy yeah, that was a generalization, of course it doesn’t apply in all cases, yet I’ve found it pretty repeatable throughout my aquitance-base ;)
DTZUZO has joined #crystal-lang
<FromGitter>
<drum445> God bless Crystal
<FromGitter>
<Aaron-JM> Anyone have any crystal Lang shards they wanna see made?
<JuanMiguel>
the problem was twofold, one it lacked the run call, and that the callback has to be defined before the send
<JuanMiguel>
thx for the help guys
<FromGitter>
<Sija> @dscottboggs_gitlab if you mean argument type restrictions, then yes, return type - no
<FromGitter>
<dscottboggs_gitlab> Interesting! that's the opposite of how I thought it would be! Is there documentation you can refer me to or could you provide me with a quick example of the syntax?
<FromGitter>
<Sija> syntax is the same of for the normal methods, i.e. `abstract def foo(name : String)`, aside of `abstract` at the beginning :)
<FromGitter>
<dscottboggs_gitlab> ah, ok
<FromGitter>
<dscottboggs_gitlab> I'm curious, is there a reason return type restrictions aren't allowed?
<FromGitter>
<Sija> you were quicker, I was just writing that :)
<FromGitter>
<Sija> see #6771
<FromGitter>
<dscottboggs_gitlab> actually, for the case I was thinking of, I think I can just define the actual method on the abstract class, so no need, but I'll definitely check that out. Thanks! :)
<FromGitter>
<Sija> tl;dr - because semantics are somewhat messy around the corners ;)
<FromGitter>
<Sija> if you need it implemented explicitly by each of the subclasses you gonna need to use `abstract def`
<FromGitter>
<Sija> but you might know that already, all the best :)
DTZUZO has joined #crystal-lang
<FromGitter>
<dscottboggs_gitlab> @Sija woohoo that is a fun problem
<FromGitter>
<Sija> yep, you’ve touched a sore point ;)
<FromGitter>
<dscottboggs_gitlab> I was really dismayed to see type restriction syntax being used as documentation. That could lead to some terrifically nasty bugs
<FromGitter>
<Sija> true, current state of things is messed-up in this regard, as you might see in before mentioned PR there’s a will to change that :) question is - to which version? removing them would “fix” the issue at hand, while removing quite useful feature, 2nd option is more ambitious and as asterite pointed out, would call for sorting out the logic behind (and likely a decent language spec)
<FromGitter>
<dscottboggs_gitlab> is there a language spec at all?
<FromGitter>
<Sija> I don’t think so
<FromGitter>
<Sija> of course aside of `spec/`
Tortice has quit [Remote host closed the connection]
<FromGitter>
<j8r> Dumb question: what is the main pros of inheritance in Crystal vs composition? I always hand up by using compoistion over inheritance, because of the flexibility, multiple includes and structs
<oprypin>
composition is popular these days. if it works well for you, just go for it
JuanMiguel has quit [Quit: This computer has gone to sleep]