jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.5 | 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
trapped has joined #crystal-lang
sailorswift has joined #crystal-lang
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
havenwood has joined #crystal-lang
havenwood has quit [Ping timeout: 240 seconds]
kyrylo has quit [Quit: Konversation terminated!]
kyrylo has joined #crystal-lang
blue_deref has joined #crystal-lang
havenwood has joined #crystal-lang
blue_deref has quit [Quit: bbn]
Dreamer3 has quit [Ping timeout: 256 seconds]
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sailorswift has joined #crystal-lang
kyrylo has quit [Ping timeout: 252 seconds]
havenwood has quit [Ping timeout: 264 seconds]
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
nahtnam has joined #crystal-lang
havenwood has joined #crystal-lang
BlaXpirit has joined #crystal-lang
<dzv> is there a way to turn a string literal to a number literal? to_i doesn't seem to work
<BlaXpirit> dzv, huh, why not
<BlaXpirit> u mean in macros?
<BlaXpirit> >> "5".to_i # because this works
<DeBot> BlaXpirit: # => 5 - http://carc.in/#/r/aux
<dzv> {{ "test".to_i }} in ./t.cr:1: undefined macro method 'StringLiteral#to_i'
<dzv> trying to do this in a macro
<BlaXpirit> strange, strange
elia has joined #crystal-lang
strcmp1 has quit [Quit: Leaving]
elia has quit [Quit: Computer has gone to sleep.]
elia has joined #crystal-lang
elia has quit [Quit: Computer has gone to sleep.]
sailorswift has joined #crystal-lang
dbackeus has joined #crystal-lang
elia has joined #crystal-lang
vegai has quit [Ping timeout: 244 seconds]
vegai has joined #crystal-lang
<jhass> dzv: if it contains a valid number literal, just .id it
<jhass> >> {{"123".id}}
<DeBot> jhass: # => 123 - http://carc.in/#/r/avd
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
leafybasil has quit [Ping timeout: 245 seconds]
elia has quit [Quit: Computer has gone to sleep.]
<nopc0de> This "can't infer block return type" is so frustrating
<nopc0de> I wish the error was more accurate
sdogruyol has joined #crystal-lang
<sdogruyol> hey @asterite is this https://github.com/manastech/crystal_ruby still working in 0.7.x i'M pretty interested in writing an extension for ruby
leafybasil has joined #crystal-lang
kyrylo has joined #crystal-lang
sdogruyol has quit [Read error: Connection reset by peer]
sdogruyol has joined #crystal-lang
Peekmo has joined #crystal-lang
sdogruyo_ has joined #crystal-lang
sdogruyol has quit [Ping timeout: 240 seconds]
nahtnam has quit [Quit: Connection closed for inactivity]
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<dzv> id worked. thanks
<dzv> now another macro problem. can comparisons be done in ifdef? ifdef VERSION > x
<BlaXpirit> dzv, that is just not something you do
<BlaXpirit> ifdef is only for flags
<BlaXpirit> say what you actually want
<dzv> compile time version checks for platform specific features
<BlaXpirit> dzv, how would you obtain this VERSION anyway?
<jhass> ifdef, uhm, symbols(?) don't have a value, they are the value
<dzv> i have the version from {{ `command`.id }}
<BlaXpirit> {% if `command` blah blah
<jhass> yeah, ifdef != macro level if
<dzv> oh
<dzv> ok
sdogruyo_ has quit [Remote host closed the connection]
<BlaXpirit> ifdef is just such a weird beast
<dzv> {% if linux %} - undefined macro variable linux
<dzv> are linux and darwin not macro variables? are they special ifdef variables?
<jhass> yes
<jhass> and as said, variable is not really the right term
<jhass> they're either defined or not
mcgain has quit [Quit: mcgain]
mcgain has joined #crystal-lang
Peekmo has quit [Ping timeout: 246 seconds]
mcgain_ has joined #crystal-lang
mcgain has quit [Ping timeout: 246 seconds]
mcgain_ is now known as mcgain
<dzv> macros don't have access to __DIR__ or __FILE__?
<jhass> what would you need that for?
<dzv> specs. i'm an existing style of spec wrapped in a platform specific macro check
<dzv> the build fails if i use a normal if and not a macro if because it tries to link to LibC.foo which is missing.
<jhass> I don't follow why you'll need access to __DIR__ or __FILE__ at the macro level though
<dzv> technically i probably don't but i'm following the style of existing specs to access specific files and dirs
<jhass> I think you should show some code, I don't follow at all
<jhass> maybe the gotcha is that you don't need to be in a macro to enter the macro language?
blassin has joined #crystal-lang
<blassin> hey!
<blassin> is there a way to know an anonymous function's arity?
<blassin> I have this code http://carc.in/#/r/awe it works, until I add a function taking arguments
<blassin> (line 18)
<blassin> I can't do v.call for the other blocks with an argument, so I guess I have to do it conditionally? but how can I tell the block's arity?
<blassin> I can also not pass the arg, and just hack around with the next index on ARGV, but seems hacky
<BlaXpirit> sigh... blassin, i cant find a way
<blassin> am I doing something wrong?
<blassin> why the sigh? :D
<BlaXpirit> blassin, u are doing something unusual for a compiled language
<blassin> ok
<blassin> I just saw this "clik" library for CLI parsing and was wondering how it could work
<blassin> it doesn't work in current clik
<blassin> *crystal
<jhass> http://carc.in/#/r/awp that'll get too hairy though
<BlaXpirit> blassin, http://carc.in/#/r/awq
<blassin> thanks!
<nopc0de> Whats the recommended usage of exceptions in crystal? Should one tried to avoid them?
<nopc0de> For example: I'm accepting data that can be json data (probably won't be) should I test it myself first or just try to parse it and catch ex
<jhass> if it's not an error if it isn't json, don't rely on the exception
<jhass> exceptions are for exceptional (= rare) cases
<jhass> in other words for when something happens you usually don't expect in normal operation
<jhass> that's true for any language btw
<nopc0de> ok thanks jhass
blue_deref has joined #crystal-lang
<blassin> why does puts "string\n" not print the newline? you need to do puts "string\n\n" to have a single extra newline
<blassin> is that a bug?
<jhass> no, that's intentional, Ruby does the same
<jhass> puts adds a newline unless there's one
<blassin> ah didn't knpow
<blassin> thought puts was "print with added newline"
<nopc0de> Yeah I was thought different
<nopc0de> wrong, rather
orliesaurus has quit [Excess Flood]
Guest79453 has joined #crystal-lang
blassin has quit [Ping timeout: 246 seconds]
<dzv> {% "123".id %} gives me a MacroId which can't be used with > or <. is there a way to get a NumberLiteral?
<BlaXpirit> well..?
<jhass> I don't see anything in there
<jhass> and that's all you can do
<crystal-gh> [crystal] MakeNowJust opened pull request #1152: Fixed to_s for macros AST (master...fix/macro-block-to-s) http://git.io/v3WJp
kostya has joined #crystal-lang
<asterite> dzv: I'll add StringLiteral#to_i in macros
<BlaXpirit> great, makes sense
<dbackeus> asterite: question out of curiosity - how do you feel about the hype level for Crystal at this stage of development, would you rather start pushing it when it's more complete/stable or prefer as many people as possible to get into it right away?
<jhass> 1
<jhass> uh, sorry
mcgain has quit [Quit: mcgain]
<nopc0de> Did anyone reply to my msg?
<nopc0de> I dc'd
<jhass> last thing that came through from you is <nopc0de> wrong, rather
<nopc0de> Ah ok
<nopc0de> How would you make this work? http://carc.in/#/r/awv
<nopc0de> has_key?
<nopc0de> it works in ruby
<jhass> >> {"foo" => "bar", "oof" => "rab"}.has_key? "no such"
<DeBot> jhass: # => false - http://carc.in/#/r/awy
<jhass> >> {"foo" => "bar", "oof" => "rab"}["no such"]?
<DeBot> jhass: # => nil - http://carc.in/#/r/awz
<dbackeus> uhm, is there no before/after or setup/teardown in crystal spec?
<nopc0de> ooh that last one is pretty cool. Just adding a question mark :P
<jhass> dbackeus: no per describe/context one, no
<dbackeus> I found before_each in the crystal source, on what level do I use that? top level?
<jhass> yeah, Spec.before_each { } iirc
<jhass> it's meant for mocking libraries and such
<dbackeus> right, thanks
havenwood has joined #crystal-lang
Guest79453 is now known as orliesaurus
luislavena has joined #crystal-lang
<asterite> dbackeus: the question about the hype, it's hard to answer. Sometimes I think "maybe it would have been better to keep the project secret until it's really stable", but it being open source made it grow much faster, because of the many contributions that everyone is making
<asterite> You can see this much more clearly using gource (amazing visualization tool)
<asterite> Luckily for now we haven't received big negative critics, but I know that it's hard to do many things, mainly because the language is incomplete... so maybe I'd like to wait a bit more
<asterite> And I think most of the hype is "Look, a compiled Ruby!" and most don't dig much further... but those who do found that it's pretty different than a compiled Ruby
<asterite> We should really make a t-shirt that says "No, it's not compiled Ruby. But thanks for asking"
<asterite> :-)
<dbackeus> yeah, a healthy balance is probably right
<asterite> BlaXpirit: I thought about stringify vs to_s, but stringify puts a node inside a string literal: http://play.crystal-lang.org/#/r/ax4
<BlaXpirit> asterite, yeah, i probably just don't understand the semantics
<asterite> Hmm... maybe it's hard to tell from that example...
<BlaXpirit> but it's not like anyone explained the semantics to me :(
<asterite> BlaXpirit: oh, I say because I read what you say and asked myself "Hey, why don't we rename to to_s?", but then I rememebered...
blassin has joined #crystal-lang
<blassin> hey, is anyone able to reach the Bountysource page?
<blassin> ah, I see there's a new URL - nvrmind
<luislavena> asterite: any docs/info on how to produce truly static executables? attempt to use -static with --link-flags just results in errors
<asterite> luislavena: no :(
<asterite> I think we have the static on the lib declaration, but that's probably wrong
<luislavena> I know -Wl,-Bstatic doesn't work on OSX, but I saw a few projects using -static in the --link-flags (which actually doesn't work)
<crystal-gh> [crystal] asterite closed pull request #819: Optimize Array.shift (master...new-shift) http://git.io/vLZ4Q
<crystal-gh> [crystal] asterite closed pull request #979: Adds a bunch of documentation to array (master...array-docs) http://git.io/vmv6d
<crystal-gh> [crystal] asterite pushed 4 new commits to master: http://git.io/v3lLE
<crystal-gh> crystal/master cafe2c8 Will Leinweber: add zsh completion
<crystal-gh> crystal/master cafe8ad Will Leinweber: Improve completion script. Thanks to Oliver Kiddle for feedback...
<crystal-gh> crystal/master cafedfb Will Leinweber: completion: add programfile to hierarchy
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/v3lLp
<crystal-gh> crystal/master 9b786d5 Ary Borenszweig: Changed `--no-build` to `--no-codegen` in zsh completion
<crystal-gh> [crystal] asterite closed pull request #1116: Add permutation method for array (master...add-permutation) http://git.io/vO5qH
<luislavena> asterite: got my response for OSX: https://developer.apple.com/library/mac/qa/qa1118/_index.html
<luislavena> going to focus on Linux then :P
<travis-ci> manastech/crystal#2d26511 (master - Merge branch 'zamith-array-docs'): The build passed. https://travis-ci.org/manastech/crystal/builds/75097429
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/v3lsF
<crystal-gh> crystal/master 1a8d8c1 Ary Borenszweig: Renamed `permutation` (no block) to `permutations`. Renamed `permutation` (with block) to `each_permutation`. Optimized both methods.
<travis-ci> manastech/crystal#2b35f47 (master - Merge pull request #1105 from will/zsh): The build was broken. https://travis-ci.org/manastech/crystal/builds/75097695
<travis-ci> manastech/crystal#9b786d5 (master - Changed `--no-build` to `--no-codegen` in zsh completion): The build was broken. https://travis-ci.org/manastech/crystal/builds/75097852
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/v3lCS
<crystal-gh> crystal/master 9f07d04 Ary Borenszweig: Merge pull request #1145 from PragTob/iterator-compact-map...
<crystal-gh> crystal/master 8e1a84b Tobias Pfeiffer: Implement Iterator#compact_map
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/v3llG
<crystal-gh> crystal/master c24cbe2 Ary Borenszweig: Fixed type of compact_map iterator. Related to #1145
<travis-ci> manastech/crystal#a717739 (master - Merge pull request #1116 from jalyna/add-permutation): The build was broken. https://travis-ci.org/manastech/crystal/builds/75097997
<crystal-gh> [crystal] asterite closed pull request #1142: Improve documentation of struct in regards when to use it (gh-pages...clarify-struct-vs-class) http://git.io/v3sgD
<travis-ci> manastech/crystal#1a8d8c1 (master - Renamed `permutation` (no block) to `permutations`. Renamed `permutation` (with block) to `each_permutation`. Optimized both methods.): The build was broken. https://travis-ci.org/manastech/crystal/builds/75099776
<crystal-gh> [crystal] asterite pushed 6 new commits to master: http://git.io/v3lE6
<crystal-gh> crystal/master a1b0304 TSUYUSATO Kitsune: Fix comment for macro if/for block style...
<crystal-gh> crystal/master 0ce98b1 TSUYUSATO Kitsune: Add to_s spec for macros
<crystal-gh> crystal/master 08c8eca TSUYUSATO Kitsune: Fix to_s for MacroIf and MacroFor missing '%'
<travis-ci> manastech/crystal#9f07d04 (master - Merge pull request #1145 from PragTob/iterator-compact-map): The build is still failing. https://travis-ci.org/manastech/crystal/builds/75101547
<travis-ci> manastech/crystal#c24cbe2 (master - Fixed type of compact_map iterator. Related to #1145): The build was fixed. https://travis-ci.org/manastech/crystal/builds/75101950
<travis-ci> manastech/crystal#dbccd29 (master - Merge pull request #1152 from MakeNowJust/fix/macro-block-to-s): The build was fixed. https://travis-ci.org/manastech/crystal/builds/75103638
zamith has joined #crystal-lang
kyrylo has quit [Remote host closed the connection]
sleeper is now known as sleeper_
blue_deref has quit [Quit: bbn]
kyrylo has joined #crystal-lang
<blassin> how can one convert a hex string into an Int32?
<jhass> >> "abcdef".to_i(16)
<DeBot> jhass: # => 11259375 - http://carc.in/#/r/ay6
<blassin> thanks!
<jhass> to_i64/to_u64 etc should take that argument too
<blassin> doesn't work with the 0x :/
<blassin> but yeah, thanks
shama has joined #crystal-lang
<jhass> it's a bit fishy that you have that as a string in the first place, but yeah, just chop that part off
icezimm has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
leafybasil has quit [Ping timeout: 246 seconds]
kostya has quit [Quit: Leaving]
<asterite> >> "0xabcdef".to_i(16, prefix: true)
<DeBot> asterite: # => 11259375 - http://carc.in/#/r/ay8
<asterite> >> "abcdef".to_i(16, prefix: true)
<DeBot> asterite: # => 11259375 - http://carc.in/#/r/ay9
<jhass> ooh, tricky
dbackeus_ has joined #crystal-lang
dbackeus has quit [Ping timeout: 250 seconds]
zamith has quit [Quit: Be back later ...]
blassin has quit [Quit: Page closed]
luislavena has quit [Remote host closed the connection]
<crystal-gh> [crystal] will opened pull request #1153: Base64 (master...base64) http://git.io/v38oF
strcmp1 has joined #crystal-lang
luislavena has joined #crystal-lang
zamith has joined #crystal-lang
<crystal-gh> [crystal] PragTob opened pull request #1154: Rename Enumerable#drop to skip for consistency with Iterator (master...rename-enumerable-drop-to-skip) http://git.io/v34LX
kulelu88 has joined #crystal-lang
elbow_jason has joined #crystal-lang
blue_deref has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #1154: Rename Enumerable#drop to skip for consistency with Iterator (master...rename-enumerable-drop-to-skip) http://git.io/v34LX
NeverDie has joined #crystal-lang
<travis-ci> manastech/crystal#a6bd50c (master - Merge pull request #1154 from PragTob/rename-enumerable-drop-to-skip): The build passed. https://travis-ci.org/manastech/crystal/builds/75145689
luislavena has quit []
Peekmo has joined #crystal-lang
NeverDie has quit [Max SendQ exceeded]
NeverDie has joined #crystal-lang
dbackeus_ has quit [Remote host closed the connection]
dbackeus has joined #crystal-lang
dbackeus has quit [Ping timeout: 244 seconds]
leafybasil has joined #crystal-lang
leafybasil has quit [Read error: Connection reset by peer]
leafybasil has joined #crystal-lang
Peekmo has quit [Quit: Page closed]
blue_deref has quit [Quit: bbn]
waj has joined #crystal-lang
waj has quit [Client Quit]
waj has joined #crystal-lang
BlaXpirit has quit [Quit: Konversation]
waj has quit [Client Quit]
waj has joined #crystal-lang
ylluminate has quit [Remote host closed the connection]
NeverDie has quit [Ping timeout: 272 seconds]
[spoiler] has joined #crystal-lang
<jhass> o/
<[spoiler]> jhass: \o
TheMysticWyvern has joined #crystal-lang
<jhass> alright, most important channel feature:
<jhass> >> "hi"
<DeBot> jhass: # => "hi" - http://carc.in/#/r/azg
<jhass> :P
ylluminate has joined #crystal-lang
<TheMysticWyvern> Hello!
<jhass> hi!
<TheMysticWyvern> I am new to everything to do with everything. It's nice to meet you!
<[spoiler]> Ooh, jesus, there's even a Crystal bot in here. That's badass! :D
<jhass> DeBot is written in Crystal ;)
<TheMysticWyvern> Ugh, I'm so envious of you.
<TheMysticWyvern> I would love to be able to write in Crystal, or even Ruby.
<jhass> start with Ruby, dynamically typed languages provide one concept less to learn to get anywhere
<TheMysticWyvern> I've been using Lynda.com's Ruby Essential Training series, but it's like... version 1.8.0 or something.
<TheMysticWyvern> I'm sure a lot's changed since then.
<jhass> Chris Pine's Learn to program has good reviews
<[spoiler]> TheMysticWyvern: did you try the try-ruby thing?
<TheMysticWyvern> I'm a bit cautious about learning Ruby from Captain Kirk.
<qb> codecademy has courses on ruby
<[spoiler]> oh and a friend of mine did codeadacemy and asked me to take a look at them, and yeah they were good
<jhass> I don't like the codestyle codeacademy uses too much
<jhass> they have things like "#{foo}" in the examples
<[spoiler]> Huh? Just "#{foo}" or more like "Hello #{foo}, how are you?"
<[spoiler]> I mean using #{} is common, so I do think they should introduce it
<jhass> the latter would be fine, no literally "#{var}"
<[spoiler]> oh, no, that's sad, I overlooked it probably
<[spoiler]> or didn't think much of it
<[spoiler]> if I did see it
<jhass> it's in the later examples, the first few do it proper
<[spoiler]> Why would they use that though?
<[spoiler]> It's more common to use #to_s in that case
<jhass> I have no idea
<[spoiler]> We should complain!
<[spoiler]> We're responsible Rubists, innit.
<jhass> I see that anti pattern regularly in newcomer code and wondered where it came from, codeacademy was a likely candidate so I went through it until I indeed found it there
<jhass> iirc they also show for
<strcmp1> jhass, ur my favorite german
leafybas_ has joined #crystal-lang
TheMysticWyvern_ has joined #crystal-lang
leafybasil has quit [Read error: Connection reset by peer]
<jhass> not funny bot?
<[spoiler]> jhass: I prefer the funny bot, sorry
<jhass> that's fine, I do too
<[spoiler]> :P
<[spoiler]> for as in for loop?
nopc0de has quit [Excess Flood]
nopc0de has joined #crystal-lang
TheMysticWyvern has quit [Ping timeout: 260 seconds]
<jhass> yeah
<[spoiler]> Meh. I have nothing against it, but I don't think it's very idiomatic
<[spoiler]> It exists only because
* [spoiler] forgot to add a period
waj has quit [Ping timeout: 245 seconds]
<jhass> thank god Crystal slayed it
TheMysticWyvern_ is now known as TheMysticWyvern
zz_Cidan has joined #crystal-lang
NeverDie has joined #crystal-lang
Raimondi 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
<crystal-gh> [crystal] asterite closed pull request #1153: Base64 (master...base64) http://git.io/v38oF
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/v3Rfc
<crystal-gh> crystal/master 8549c5a Ary Borenszweig: Fixed #1079: Crash when iterating empty array of modules
<travis-ci> manastech/crystal#92e6d11 (master - Merge pull request #1153 from will/base64): The build passed. https://travis-ci.org/manastech/crystal/builds/75183615
<travis-ci> manastech/crystal#8549c5a (master - Fixed #1079: Crash when iterating empty array of modules): The build passed. https://travis-ci.org/manastech/crystal/builds/75185274