jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.14.1 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
trapped has quit [Read error: Connection reset by peer]
Philpax has joined #crystal-lang
Raimondi has joined #crystal-lang
A124 has joined #crystal-lang
krtv` has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
soveran has quit [Ping timeout: 276 seconds]
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Philpax has quit [Ping timeout: 260 seconds]
Philpax has joined #crystal-lang
kfpratt has quit []
bjz has joined #crystal-lang
bjz_ has joined #crystal-lang
ragmaanir has quit [Quit: Leaving]
bjz has quit [Ping timeout: 244 seconds]
soveran has joined #crystal-lang
Philpax has quit [Ping timeout: 260 seconds]
soveran has quit [Ping timeout: 276 seconds]
Philpax has joined #crystal-lang
Gasher has quit [Quit: Leaving]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
fridgerator has joined #crystal-lang
Gasher has joined #crystal-lang
Gasher has quit [Ping timeout: 244 seconds]
Gasher has joined #crystal-lang
soveran has joined #crystal-lang
tony_ has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
<tony_> Hello
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
fridgerator has quit [Quit: Textual IRC Client: www.textualapp.com]
fridgerator has joined #crystal-lang
fridgerator has quit [Client Quit]
fridgerator has joined #crystal-lang
<emancu> hello
tony_ has quit [Ping timeout: 248 seconds]
<Gasher> hello
fridgerator has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bcardiff has joined #crystal-lang
soveran has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
soveran has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit []
Philpax has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
emancu has quit []
fridgerator has joined #crystal-lang
Philpax has joined #crystal-lang
fridgerator has quit [Quit: Textual IRC Client: www.textualapp.com]
<donpdonp> hello
Philpax has quit [Ping timeout: 260 seconds]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 252 seconds]
stef__ has quit [Quit: Leaving]
soveran has joined #crystal-lang
petercommand has quit [Ping timeout: 260 seconds]
petercommand has joined #crystal-lang
pawnbox has quit [Ping timeout: 248 seconds]
zodiak has joined #crystal-lang
zodiak has quit [Client Quit]
zodiak has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
Philpax has joined #crystal-lang
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vaNrc
<crystal-gh> crystal/master 85bccef Brian J. Cardiff: playground: #2355 aproximate solution to allow macro calls inside class/module. and the usage of record macro.
marcosdsanchez has quit [Read error: Connection reset by peer]
<travis-ci> crystal-lang/crystal#85bccef (master - playground: #2355 aproximate solution to allow macro calls inside class/module. and the usage of record macro.): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/118168022
marcosdsanchez has joined #crystal-lang
trapped has joined #crystal-lang
bcardiff has quit [Quit: bcardiff]
A124 has quit [Quit: '']
A124 has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
willl has quit [Quit: Connection closed for inactivity]
<BlaXpirit> hello
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Gasher has quit [Quit: Leaving]
ql6wlld has joined #crystal-lang
waghanza has joined #crystal-lang
<waghanza> hi, how rpm are build ?
<waghanza> (trying to build crystal ;-)
soveran has quit [Ping timeout: 248 seconds]
soveran has joined #crystal-lang
Philpax has quit [Ping timeout: 260 seconds]
renews has joined #crystal-lang
renews has quit []
soveran has quit [Remote host closed the connection]
renews has joined #crystal-lang
renews has quit []
soveran has joined #crystal-lang
renews has joined #crystal-lang
waghanza has quit [Ping timeout: 244 seconds]
donpdonp has quit [Ping timeout: 260 seconds]
donpdonp has joined #crystal-lang
waghanza has joined #crystal-lang
trapped has joined #crystal-lang
soveran has quit [Remote host closed the connection]
ruslux has joined #crystal-lang
Philpax has joined #crystal-lang
soveran has joined #crystal-lang
emancu has joined #crystal-lang
tony__ has joined #crystal-lang
tony__ has quit [Read error: Connection reset by peer]
tony__ has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
bcardiff has joined #crystal-lang
Philpax has quit [Ping timeout: 240 seconds]
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vaAb8
<crystal-gh> crystal/master b7f070d Brian J. Cardiff: fix #2362 ToSVisitor was rendering Visibility enum with the default enum case instead of using crystal syntax.
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vaAAR
<crystal-gh> crystal/master 06d093b Brian J. Cardiff: add spec related to #2362
<travis-ci> crystal-lang/crystal#b7f070d (master - fix #2362 ToSVisitor was rendering Visibility enum with the default enum case instead of using crystal syntax.): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/118248207
<travis-ci> crystal-lang/crystal#06d093b (master - add spec related to #2362): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/118250824
jnylen has joined #crystal-lang
steamy has quit [*.net *.split]
Cyrus has quit [*.net *.split]
wmoxam_ has quit [*.net *.split]
jnylen is now known as steamu
steamu is now known as steamy
<tilpner> >> def array(v : T); [v]; end; array 42 # Why does this work...
<DeBot> tilpner: # => [42] - https://carc.in/#/r/v2z
marcosdsanchez has quit [Read error: Connection reset by peer]
<tilpner> >> def array(v : T) : Array(T); [v]; end; array 42 # ... but this doesn't?
<DeBot> tilpner: undefined constant T - https://carc.in/#/r/v30
marcosdsanchez has joined #crystal-lang
<BlaXpirit> tilpner: strange
<BlaXpirit> well it's not really needed anyway
<tilpner> This is just an example I'm using to understand another oddity, where it's required.
tony__ has quit [Ping timeout: 264 seconds]
Cyrus has joined #crystal-lang
Cyrus is now known as Guest36566
<tilpner> >> def maybe(v : T?, &block : T -> U) : U?; if v; yield v; else; nil; end; end; p maybe("foo", &.reverse) # What about this, BlaXpirit?
<DeBot> tilpner: undefined constant U - https://carc.in/#/r/v3i
<BlaXpirit> >> def maybe(v); yield v if v; end; p maybe("foo", &.reverse)
<DeBot> BlaXpirit: "oof" - more at https://carc.in/#/r/v3j
<BlaXpirit> tilpner:
wmoxam_ has joined #crystal-lang
soveran has quit []
emmanueloga has quit [Ping timeout: 248 seconds]
<BlaXpirit> I mean it's great to state these types for documentation and it sucks that this doesn't work but yeah...
emmanueloga has joined #crystal-lang
<tilpner> Oh, I see. Is there some syntax for this? Is it possible to write foo.maybe(&.reverse)?
<tilpner> (I mean, syntax I've missed that does something similar to "maybe")
<BlaXpirit> tilpner: you can add methods to types
<BlaXpirit> struct Object; and whatever
<BlaXpirit> and there is this thing indeed
<BlaXpirit> foo.try &.reverse
<BlaXpirit> >> [1,2,3].try &.reverse
<DeBot> BlaXpirit: # => [3, 2, 1] - https://carc.in/#/r/v3k
<tilpner> I've read that I can, but isn't that frowned upon (adding methods to Object)?
<BlaXpirit> yeah
tony_ has joined #crystal-lang
<tilpner> >> nil.try &.reverse
<DeBot> tilpner: # => nil - https://carc.in/#/r/v3m
<tilpner> Ah, okay.
<ruslux> Sry. Anybody have docs in .pdf?
<tilpner> Thanks a lot, BlaXpirit! Do you know if there's an issue for this?
<BlaXpirit> I don't know. I forgot this feature even existed outside of classes
<BlaXpirit> ruslux: crystal-lang.org/docs in pdf?
<ruslux> Yes
<BlaXpirit> ruslux: I don't think they exist but that can be arranged
<ruslux> I tried a lot of site-to-pdf-converters, but all of them convert only 1 page
<ruslux> In any case, tnx!
<ruslux> Where i can find docs sources?
<ruslux> Oh, tnx!
<BlaXpirit> ruslux, install 'calibre'; gitbook pdf _gitbook
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vaxte
<crystal-gh> crystal/master 0309024 Brian J. Cardiff: Playground: do not instrument constants declarations #2353
<BlaXpirit> neat stuff
<BlaXpirit> I would suggest putting it up on the website but generating pdf every time is gonna do quite a number on the repository size
<ruslux> Wow, it's awesome! Thank you!
kfpratt has joined #crystal-lang
bcardiff has quit [Quit: bcardiff]
ruslux has quit [Remote host closed the connection]
<travis-ci> crystal-lang/crystal#0309024 (master - Playground: do not instrument constants declarations #2353): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/118265601
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
trapped has joined #crystal-lang
pawnbox has joined #crystal-lang
ql6wlld has quit [Quit: WeeChat 1.4]
tony__ has joined #crystal-lang
tony_ has quit [Ping timeout: 260 seconds]
ssvb has quit [Ping timeout: 244 seconds]
tony__ has quit [Ping timeout: 260 seconds]
ssvb has joined #crystal-lang
ssvb has quit [Read error: Connection reset by peer]
ssvb has joined #crystal-lang
<crystal-gh> [crystal] DougEverly opened pull request #2363: Added Process.daemonize (master...daemonize) https://git.io/vaxHy
renews has quit [Remote host closed the connection]
Ven has joined #crystal-lang
tony_ has joined #crystal-lang
tony_ has quit [Ping timeout: 260 seconds]
<emancu> how can I print the code generated by some macros ?
<emancu> i mean, i want to call a few macros and see the output before transforming to llvm
<BlaXpirit> emancu, {{debug}}
<emancu> just put {{debug}} and that's it ?
<BlaXpirit> if i remember correctly
<BlaXpirit> and i don'y
<BlaXpirit> and i don't
<BlaXpirit> emancu, https://carc.in/#/r/v3x
<emancu> ok thx
<emancu> BlaXpirit: do you know a way to insert code passed by an array of blocks ?
<emancu> i want to define a few blocks
<emancu> and when I call a macro
<BlaXpirit> array of blocks? hmm i don't think that's possible
<emancu> insert the code inside of those blocks
<emancu> it is :)
<emancu> Array( -> _)
<emancu> that is an array of blocks with no args
<emancu> which is exactly what i want
<BlaXpirit> emancu, how do you do it with 1 block?>
<emancu> lets say that block1 is { emancu_test = 1} and blcok2 is {blaxpirit_test = 1}
<emancu> and I have an array with block1, block2
<emancu> I want to define a macro `build` which receives a block BUT first inserts block1 and block2 code BEFORE the actual {{yield}}
<emancu> asterite: ^
<emancu> BlaXpirit: sorry, i don't get you :/
<BlaXpirit> emancu, please show how you pass these blocks
<BlaXpirit> even if you don't use them in the macro, how can you pass them?
<emancu> well, to a macro, i don't know how to do that ^^
<emancu> i was keeping track of them on a class variable
<BlaXpirit> ok here you go, emancu. https://carc.in/#/r/v4i
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
willl has joined #crystal-lang
<emancu> i would like to compose code doing that but i'm afraid that would be impossible
<BlaXpirit> emancu, appears so
<BlaXpirit> at least you can use strings
<emancu> question.. the macros are resolved BEFORE infer the types ?
<BlaXpirit> macros are just a templating language
<emancu> so maybe it is possible
<BlaXpirit> emancu, sigh https://carc.in/#/r/v4y
<BlaXpirit> .id is really .to_s
<emancu> hmmm that is really ugly to do :/
<emancu> but it works
<BlaXpirit> emancu, I can't seem to pass a multi-statement block anyway
<BlaXpirit> at that point may as well use strings
tony_ has joined #crystal-lang
<emancu> BlaXpirit: let me give you some context and maybe you helpe me to find a clever solution
<emancu> i'm writing a test framework and I want to define a `before` block
<emancu> to run before each test
<emancu> the thing is, i want to share the code defined so i can use the variables from the `before` block inside a test
<BlaXpirit> i don't believe that this hasn't been solved elsewhere
waghanza has quit [Remote host closed the connection]
<emancu> i didn't find it in `crystal/spec`
Ven has joined #crystal-lang
<RX14> emancu, use spec2
<RX14> it has before/after
<RX14> and other nice things
<RX14> i also reccomend power_assert for assertions
<emancu> RX14: do you have the repo ?
<RX14> emancu, here is power_assert patched for spec2: https://github.com/RX14/power_assert.cr
<emancu> i don't like it.
<emancu> it adds too many things that i don't need
<emancu> and also pollutes the Object class
<RX14> just don't use them?
<RX14> spec2 doesn't pollute object
<RX14> it's literally right there under "goals"
<RX14> it has Object class patching behind a flag
<RX14> and default spec pollutes Object a lot
<emancu> yes, that is why i don't want to use default spec
<RX14> so use spec2
<RX14> it solves all your problems
<emancu> kind of
<emancu> i want to keep it simple as cutest in ruby
<RX14> also BlaXpirit -> https://carc.in/#/r/v5o
<RX14> oh, that's not working
tony_ has quit [Ping timeout: 264 seconds]
tony_ has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dsounded has joined #crystal-lang
<dsounded> hello, I've got this:
<dsounded> Error while requiring "prelude" How to fix it ?
dsounded has quit [Client Quit]
<BlaXpirit> ...
<emancu> BlaXpirit: RX14 https://carc.in/#/r/v68 what is wrong with this ?
<BlaXpirit> emancu, you don't seem to understand these concepts at all
<emancu> nope =(
<RX14> emancu, macros recieve AST nodes
<BlaXpirit> you can't pass a runtime object to a macro
<RX14> not variables
<RX14> the type of blocks is a varref
<emancu> BlaXpirit: right!
<BlaXpirit> like i said, it's basically a templating language
<RX14> it operates before typings and such
<RX14> and it's much more than a templating langauge
<RX14> it gets AST nodes
<RX14> which is really useful for manipulating the AST
<RX14> but you can't make an array of blocks
<RX14> because blocks have no runtime type
<RX14> you have to use procs
<emancu> but, i think there is a way to keep track of the AST nodes and use them
<emancu> or i hope that
<emancu> if i can use procs to paste code, it is ok for me
renews has joined #crystal-lang
renews has quit [Client Quit]
renews has joined #crystal-lang
<emancu> there are too many nested things it is easy to get lost :S
<RX14> because that array is created in the macro VM
<RX14> and blocks ARE objects in the macro universe
<RX14> the basic rule is, blocks can only be passed to methods
<RX14> not stored
<RX14> and only 1 block passed
<emancu> is there any docs about it ?
<RX14> spec2 has one "after" macro which recieves this proc and stores it, which is possible because it's a mcro
<RX14> but you can't pass multiple blocks to 1 macro
<RX14> you have to call the mcro multiple times
<RX14> emancu, not really any docs, just common sense
<emancu> well but I can compose blocks and pass it to a macro and end building the entire "block" with all the code nested
<emancu> or again I'm missing something
<RX14> what do you mean?
pawnbox has quit [Remote host closed the connection]
<emancu> maybe the macro `before` should define a "method" where I can extract the code later on macro `it`
<emancu> in other words, how can I get the AST of an already defined method ?
tony_ has quit [Ping timeout: 260 seconds]
tony_ has joined #crystal-lang
<emancu> RX14: asterite ^
renews has quit []
marcosdsanchez has quit [Read error: Connection reset by peer]
marcosdsanchez has joined #crystal-lang
[spoiler] has quit [Ping timeout: 240 seconds]
victor_lowther has quit [Ping timeout: 240 seconds]
iamstef has quit [Ping timeout: 240 seconds]
aemadrid has quit [Ping timeout: 240 seconds]
guilleiguaran__ has quit [Ping timeout: 240 seconds]
x0f has quit [Ping timeout: 240 seconds]
victor_lowther has joined #crystal-lang
iamstef has joined #crystal-lang
aemadrid has joined #crystal-lang
guilleiguaran__ has joined #crystal-lang
bjz_ has quit [Max SendQ exceeded]
_kfpratt has joined #crystal-lang
[spoiler] has joined #crystal-lang
x0f has joined #crystal-lang
kfpratt has quit [Ping timeout: 240 seconds]
bjz has joined #crystal-lang
wmoxam_ has quit [*.net *.split]
<RX14> emancu, i don't think you can
<RX14> just
wmoxam_ has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
trapped has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
matp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has quit [Ping timeout: 276 seconds]
tony_ has quit [Ping timeout: 260 seconds]