jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.9.0 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
leafybas_ has joined #crystal-lang
leafybasil has quit [Ping timeout: 246 seconds]
leafybas_ has quit [Ping timeout: 256 seconds]
blue_deref has quit [Quit: Taking myself out of hear.]
blue_deref2 has joined #crystal-lang
blue_deref2 has quit [Remote host closed the connection]
blue_deref has joined #crystal-lang
glenab has joined #crystal-lang
<Tetsumi> how can i check if a string validly represent a float number ?
<Tetsumi> "abc".to_f returns 0 while "abc".to_i raises an exception
NeverDie has quit [Quit: http://radiux.io/ -> Manhattan Project]
<jhass> good point, to_f should raise too, feel free to open an issue or send a PR
<jhass> I'd use .match /\A[-+]?\d+\.\d+(e[+-]\d+)?\z/
<jhass> if all you care is to know whether it looks like one
nakilon has quit [Ping timeout: 272 seconds]
* CompanionCube is writing something in Ruby that he later plans to rewrite in Crystal
<crystal-gh> [crystal] waterlink closed pull request #1816: Add HTTP::Request#body_params (master...add-body-params-to-http-request) http://git.io/vWgg7
glenab has quit []
vikaton has quit [Quit: Connection closed for inactivity]
Tetsumi has quit [Quit: Leaving]
circ-user-biPkM has joined #crystal-lang
benner_ has joined #crystal-lang
benner has quit [Read error: Connection reset by peer]
leafybasil has joined #crystal-lang
zz_Cidan is now known as Cidan
buggs has quit [Quit: WeeChat 0.4.2]
circ-user-biPkM has quit [Ping timeout: 265 seconds]
leafybasil has quit [Remote host closed the connection]
arcwest1 has joined #crystal-lang
barosl has quit [Quit: Leaving]
barosl has joined #crystal-lang
arcwest1 has quit [Ping timeout: 246 seconds]
circ-user-biPkM has joined #crystal-lang
canhtak has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
reed_ has joined #crystal-lang
canhtak has quit [Quit: canhtak]
benoist has joined #crystal-lang
canhtak has joined #crystal-lang
Cidan is now known as zz_Cidan
benoist has quit [Remote host closed the connection]
zz_Cidan is now known as Cidan
circ-user-biPkM has quit [Remote host closed the connection]
reed_ has quit [Ping timeout: 252 seconds]
BlaXpirit has joined #crystal-lang
circ-user-bNaS0 has joined #crystal-lang
blue_deref has quit [Quit: bbn]
Raimondii has joined #crystal-lang
gamemanj has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
benoist has joined #crystal-lang
circ-user-bNaS0 has quit [Ping timeout: 255 seconds]
<benoist> jhass: you here?
<benoist> can anyone explain what {% begin %} {% end %} does? Like here: https://github.com/manastech/crystal/pull/1811/files#diff-2b93096d8ed5f75591e27ddb3435e37cR87
circ-user-bNaS0 has joined #crystal-lang
<BlaXpirit> benoist, just that without it you wouldn't be able to use {{ }}
<benoist> so it's what you need to create macro style code inside a instance method?
circ-user-bNaS0 has quit [Ping timeout: 244 seconds]
<benoist> you just can't use function arguments in a macro style?
<BlaXpirit> benoist, i think what you said is all correct
<BlaXpirit> not entirely sure tho
<benoist> perhaps there are more examples somewhere in the codebase
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
<BlaXpirit> there sure are, but it's all the same as this
<benoist> hmm only when using Tuples
<jhass> benoist: the new way of {% if true %}, if you look around you find more examples for that one, especially in Tuple
<jhass> benoist: you do can use {{foo}} anywhere, but you would only at that point enter the macro language and what comes out needs to parse as a valid expression
<jhass> benoist: so say we try new({{@type.type_vars.argify}}) inside class Foo(A, B); with Foo(String, Int32), it would generate "String, Int32", which is not valid crystal
<jhass> benoist: with {% begin %} we can enter the macro language earlier, so the generated expression can become say new(String, Int32), which is valid Crystal and does parse
<BlaXpirit> i really should've remembered that the last time you said it :p
<BlaXpirit> seems worth a ?thing
<jhass> mmh, could be hard to condense into one
<jhass> but feel free to try to write one up
<benoist> ok I think my assumptions were right then
<benoist> is there any way to easily see the generated code via macros?
ssvb has quit [Ping timeout: 272 seconds]
<BlaXpirit> yes, benoist, but i don't remember
<BlaXpirit> easiest way is to make it be invalid xD
<BlaXpirit> add a random bracket at the end
<benoist> ah yeah that works, but only for the specific block, would be nice to see the whole file when using multiple macros :)
<BlaXpirit> ?iftrue=Code that is expanded from a top-level macro expression must be valid Crystal. That's why {% if true %} or {% begin %} are used. Example: https://github.com/manastech/crystal/blob/c6ab2f1/src/tuple.cr#L263 - `Tuple.new( self[0].clone, self[1].clone, )` is valid code, while `self[0].clone, self[1].clone,` is not.
<DeBot> BlaXpirit: Set iftrue.
<benoist> nice :)
<crystal-gh> [crystal] ysbaddaden opened pull request #1819: Reseed PRNG after fork (master...std-random-new-seed) http://git.io/vW22D
<jhass> benoist: {{debug()}} when inside the macro language (or only inside a macro? idk). crystal tool browser if your code lives inside a called method
kgadek has quit [Ping timeout: 252 seconds]
circ-user-bNaS0 has joined #crystal-lang
canhtak has quit [Quit: canhtak]
circ-user-bNaS0_ has joined #crystal-lang
<crystal-gh> [crystal] jhass closed pull request #1819: Reseed PRNG after fork (master...std-random-new-seed) http://git.io/vW22D
circ-user-bNaS0 has quit [Ping timeout: 272 seconds]
<travis-ci> manastech/crystal#c615682 (master - Merge pull request #1819 from ysbaddaden/std-random-new-seed): The build passed. https://travis-ci.org/manastech/crystal/builds/87295352
<DeBot> https://github.com/manastech/crystal/pull/1819 (Reseed PRNG after fork)
nakilon has joined #crystal-lang
canhtak has joined #crystal-lang
ssvb has joined #crystal-lang
trapped has joined #crystal-lang
leafybasil has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
edaaa_ has joined #crystal-lang
leafybasil has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
benoist has quit [Remote host closed the connection]
benoist has joined #crystal-lang
Cidan is now known as zz_Cidan
benoist_ has joined #crystal-lang
benoist has quit [Ping timeout: 256 seconds]
<jokke> jhass: is ist possible to use ecr without a separate ecr file?
<jokke> as in sth like template = "Hello <%= @name %>!"; class Greeting; def initialize(@name); end; ecr_string template; end
edaaa_ has quit [Ping timeout: 260 seconds]
leafybasil has joined #crystal-lang
ponga has joined #crystal-lang
<benoist_> the ECR class has got a render_string function
<benoist_> jokke: so it might be possible
kgadek has joined #crystal-lang
ssvb has quit [Ping timeout: 244 seconds]
leafybasil has quit [Remote host closed the connection]
<jokke> benoist_: yeah but even that method has a parameter file_name
<jhass> you need something like https://github.com/manastech/crystal/blob/master/src/ecr/process.cr that reads from standard input or takes the contents from ARGV instead
<jhass> then call it with t he run macro (that's what ecr_file does)
ssvb has joined #crystal-lang
<benoist_> jokke: is that filename not just for debugging purposes
<jokke> jhass: hm ok
<jokke> benoist_: no idea
<benoist_> so can't you just use __FILE__
<benoist_> but yeah you probably also need what jhass said
<benoist_> just replace the process_file with process_string
<benoist_> and pass the template contents as argument
ssvb has quit [Ping timeout: 244 seconds]
<benoist_> jokke: https://github.com/benoist/carbon-crystal/blob/master/src/carbon_view/process.cr here you can see how I changed the process_file to allow for missing template files
<crystal-gh> [crystal] tatey opened pull request #1820: UDPSocket#recvfrom, #send, and #sendto (master...socket-sendto-recvfrom) http://git.io/vW2xl
leafybasil has joined #crystal-lang
<jokke> thanks
<benoist_> jhass: it appears macro's are run when commented out, is that correct?
<jhass> {{/}}, {%/%} is, not sure about macro calls
leafybasil has quit [Remote host closed the connection]
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
leafybas_ has joined #crystal-lang
circ-user-bNaS0_ has quit [Read error: Connection reset by peer]
ssvb has joined #crystal-lang
circ-user-bNaS0 has joined #crystal-lang
leafybas_ has quit [Remote host closed the connection]
me has joined #crystal-lang
me is now known as Guest37314
circ-user-bNaS0 has quit [Ping timeout: 260 seconds]
<crystal-gh> [crystal] asterite pushed 4 new commits to master: http://git.io/vWasW
<crystal-gh> crystal/master 21a8f54 Ary Borenszweig: Formatter: preserve space in division or multiplication in call with obj but without args
<crystal-gh> crystal/master 89cea59 Ary Borenszweig: Formatter: don't align successive hash entries if there's more than one in the same line
<crystal-gh> crystal/master c26548b Ary Borenszweig: Formatter: no longer take arg's column into account, only current indent level
Guest37314 has quit [Ping timeout: 272 seconds]
leafybasil has joined #crystal-lang
<travis-ci> manastech/crystal#3062a0f (master - Updated Changelog): The build passed. https://travis-ci.org/manastech/crystal/builds/87312844
leafybasil has quit [Remote host closed the connection]
kgadek has quit [Read error: Connection reset by peer]
circ-user-bNaS0 has joined #crystal-lang
kgadek has joined #crystal-lang
Raimondii has quit [Quit: The road to wisdom?—Well, it's plain and simple to express: Err and err and err again, but less and less and less. — Piet Hein]
Raimondi has joined #crystal-lang
NeverDie has joined #crystal-lang
kgadek has quit [Ping timeout: 246 seconds]
me has joined #crystal-lang
me is now known as x11
x11 is now known as Guest87551
Guest87551 is now known as bx11
circ-user-bNaS0 has quit [Ping timeout: 264 seconds]
circ-user-bNaS0 has joined #crystal-lang
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
kgadek has joined #crystal-lang
bx11 has quit [Remote host closed the connection]
kgadek_ has joined #crystal-lang
kgadek has quit [Read error: Connection reset by peer]
trapped has joined #crystal-lang
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
edaaa_ has joined #crystal-lang
circ-user-bNaS0 has quit [Ping timeout: 250 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
dylanmei has quit [Quit: ZZZzzz…]
kgadek_ has quit [Quit: gone sleep]
barosl has quit [Read error: Connection reset by peer]
kgadek has joined #crystal-lang
kgadek has quit [Quit: gone sleep]
zz_Cidan is now known as Cidan
pawnbox_ has joined #crystal-lang
barosl has joined #crystal-lang
trapped has joined #crystal-lang
pawnbox has quit [Ping timeout: 246 seconds]
Cidan is now known as zz_Cidan
bx11 has joined #crystal-lang
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
reed_ has joined #crystal-lang
zz_Cidan is now known as Cidan
edaaa_ has quit [Ping timeout: 240 seconds]
pawnbox_ has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
bx11 has quit [Remote host closed the connection]
bx11 has joined #crystal-lang
pawnbox has quit [Read error: Connection reset by peer]
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
edaaa_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 246 seconds]
<benoist_> is there a way to call previous_def or if previous_def does not exists to call super?
<jhass> benoist_: start with def foo; super; end ?
<benoist_> something like this
<benoist_> yeah that requires a previous_def to be defined
<benoist_> but for my use case it's not always the case
<jhass> I'm saying make it the case
<benoist_> in what way? request a change or change my code? :)
<jhass> change your code by defining a def foo; super; end unconditionally in the leaf class
<benoist_> hmmmm let's hope thats gonna be possible
<jhass> eg. in a macro inherited
<benoist_> yeah I'm calling it from that
<benoist_> but the module is included in a parent class
<jhass> you could define a macro included that defines a macro inherited :P
<benoist_> lol just did that :)
<benoist_> tnx
<benoist_> still amazes me how much of rails can be ported to crystal :)
elia has joined #crystal-lang
benoist_ has quit [Remote host closed the connection]
benoist has joined #crystal-lang
elia has quit [Quit: Computer has gone to sleep.]
buggs has joined #crystal-lang
blue_deref has joined #crystal-lang
ponga has quit [Quit: Connection closed for inactivity]
canhtak has quit [Quit: canhtak]
benoist has quit [Remote host closed the connection]
kgadek has joined #crystal-lang
trapped has joined #crystal-lang
tomchapin has joined #crystal-lang
gamemanj has quit [Ping timeout: 240 seconds]
elia has joined #crystal-lang
nakilon has quit [Ping timeout: 256 seconds]
kgadek has quit [Ping timeout: 250 seconds]
kgadek has joined #crystal-lang
nakilon has joined #crystal-lang
elia has quit [Quit: Computer has gone to sleep.]
BlaXpirit has quit [Quit: Konversation]
nakilon has quit [Ping timeout: 256 seconds]
edaaa_ has quit [Quit: Leaving]
elia has joined #crystal-lang
bx11 has quit []
<CompanionCube> I wish someone implemented Thor for Crystal
blue_deref has quit [Quit: bbn]
blue_deref has joined #crystal-lang
elia has quit [Quit: Computer has gone to sleep.]
trapped has quit [Quit: Textual IRC Client: www.textualapp.com]
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]