<FromGitter>
<elorest> Yeah I thought of that but don't love it. Think I'll just use constants.
astronavt has joined #crystal-lang
astronavt has quit [Ping timeout: 252 seconds]
rohitpaulk has quit [Ping timeout: 250 seconds]
flaviodesousa has joined #crystal-lang
rohitpaulk has joined #crystal-lang
astronavt has joined #crystal-lang
astronavt has quit [Ping timeout: 258 seconds]
Ven`` has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
ton31337 has left #crystal-lang [#crystal-lang]
csk157 has joined #crystal-lang
snsei has quit [Remote host closed the connection]
csk157 has quit [Ping timeout: 248 seconds]
Ven`` has quit [Read error: Connection reset by peer]
Ven` has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
Ven` has quit [Client Quit]
astronavt has joined #crystal-lang
<FromGitter>
<yxhuvud> @elorest you can use %var = "test to get a unique name for your variable.
astronavt has quit [Ping timeout: 252 seconds]
Ven`` has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
csk157 has joined #crystal-lang
alex`` has joined #crystal-lang
csk157 has quit [Ping timeout: 240 seconds]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has quit [Ping timeout: 240 seconds]
Papierkorb_ has joined #crystal-lang
astronavt has joined #crystal-lang
astronavt has quit [Ping timeout: 255 seconds]
rohitpaulk has joined #crystal-lang
jokke has quit [Quit: WeeChat 1.9]
jokke has joined #crystal-lang
jokke has quit [Quit: WeeChat 1.9]
jokke has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
rohitpaulk has joined #crystal-lang
Ven`` has joined #crystal-lang
Ven`` has quit [Client Quit]
<crystal-gh>
[crystal] MakeNowJust opened pull request #5336: Parser: fix the condition to decide var or call (master...fix/crystal/var-or-call-rule) https://git.io/vbqYe
<FromGitter>
<picatz> In case anyone's interested, I made a lil 'command-line application to turn your network packets into rainbows: https://github.com/picatz/niji
<RX14>
screenshots would make me understand what that means a lot lot more
<FromGitter>
<picatz> True!
<RX14>
a screenshot above the fold of the readme please!
<FromGitter>
<picatz> Added a screenshot to the readme! :D
<RX14>
heh
<FromGitter>
<picatz> I think I'ma make a smaller/cropped version though.
<RX14>
thats cool
<FromGitter>
<picatz> Thanks! :D
<FromGitter>
<picatz> I used the binding from libpcap I made a few weeks ago.
<FromGitter>
<picatz> Like 50 lines of code.
<RX14>
you realise we have Colorize
<RX14>
so you don't have to put your escape codes into a string
<FromGitter>
<picatz> I realize we have colorize. But, it was genuinely easier for me to just write that 😓 . I totally believe there's a better way to do this.
<RX14>
yeah probably
<FromGitter>
<picatz> but, it works! 😂
<RX14>
you're probably right this is shorter since you can just smash in the 8 bit colour
<RX14>
as Colorize worries about human readable names
<FromGitter>
<picatz> I also plan on making a webapp version in the future.
<RX14>
not numbers
<FromGitter>
<picatz> Good to know 👍
<RX14>
it's fantastically short
<RX14>
shows you how good your library is
<FromGitter>
<picatz> I really like Packetz!
<RX14>
me too - from that interface
<FromGitter>
<picatz> Like, I have more work to do with it. But, I read a lot on LibPcap
<FromGitter>
<picatz> And I have been working to make it as easy as possible / don't use depreciated functions, ect.
<FromGitter>
<picatz> Like, `pcap_lookupdev` is used all over the place in libpcap bindings. But it's depreciated. So I don't use it. :shipit:
<RX14>
i have to say that's a well designed interface
<FromGitter>
<picatz> Well, crafting and parsing. But, yeah.
<FromGitter>
<picatz> Future crystal goals! 👍
csk157 has quit [Ping timeout: 240 seconds]
rohitpaulk has quit [Ping timeout: 240 seconds]
astronavt has joined #crystal-lang
astronavt has quit [Ping timeout: 252 seconds]
<FromGitter>
<elorest> @yxhuvud %var is a fresh variable which is guaranteed to be uniq but still doesn't exist within the macro scope. Does it?
<FromGitter>
<elorest> @sdogruyol DO is generously giving us droplets.
<FromGitter>
<bew> can you give an example of what you want to do @elorest ?
claudiuinberlin has joined #crystal-lang
<FromGitter>
<bew> @elorest do you want a variable for the generated code (fresh var) or a macro variable, usable in `{% %}` and `{{ }}` ?
<FromGitter>
<bew> iirc you gave an example `{% my_var = "test" %}` <= this should work, did you have issues with that?
<robacarp>
is there a way to do a generic recursive alias? ` alias ResultNest(T) = Array(RoutedResult(T) | ResultNest(T))` produces a `expecting token '=', not '('` compiler error
<FromGitter>
<elorest> I solved the problem without setting variables. But essentially I was trying to create a new variable so I could parse a variables cleaner. I ended up doing it in one line. ⏎ ⏎ /^{{path.split("/").map { |p| p.starts_with?(':') ? "(?<" + p.gsub(/\:/, "") + ">[^$\\/]+)" : p }.join("\\/").id}}$/
csk157 has joined #crystal-lang
<FromGitter>
<elorest> Yeah `{% my_var = "test" %}` was what I tried first. It just says unknown macro variable.
<livcd>
oh that's exciting news...crystal on windows ^^
<RX14>
robacarp, you can't do a generic 8any* alias
<RX14>
try just alias Foo(T) = Array(T)
<RX14>
you'll get the same error
<robacarp>
this seems to work though: ` alias ResultNest = Array(RoutedResult(T) | ResultNest)`
<RX14>
that's not a generic alias
csk157 has quit [Ping timeout: 268 seconds]
<RX14>
that's an alias of generics
<RX14>
also that won't compile because T is undefined
<RX14>
or - it shouldn't
<RX14>
i think if you tried that in master it would break
<RX14>
i assume you have that alias in a class which is generic over T
<RX14>
and thats the only reason why it works
<robacarp>
its probably given than it's in a generic class(T), why would it break in master?
<RX14>
because it's a bug that that works in the first place
<RX14>
the alias isn't "in" the class
rohitpaulk has joined #crystal-lang
<RX14>
you can't do generic alias, it sucks, but that's the thing you need
<robacarp>
the alias is defined in the class, why isn't it in the class?
<RX14>
well what I meant is that it's inside the class's namespace
<RX14>
but it's not inside the class's instance
<robacarp>
ahh, I see what you mean
<RX14>
it's a bug that Foo(T)::anything works
<RX14>
a generic should only be the last type you refer to
<RX14>
and in fact - reffering to your alias from outside probably wont work
alex`` has quit [Quit: WeeChat 1.9.1]
<RX14>
it only happens to work because you're referring to it from inside the class
<RX14>
without a preceeding namespace
<robacarp>
I'm not sure I will be referring to it outside the class