asterite changed the topic of #crystal-lang to: #crystal-lang The Crystal programming language | http://crystal-lang.org | Crystal 0.6.0 | 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
asterite has quit [Ping timeout: 264 seconds]
weskinner_mac has joined #crystal-lang
<ponga> >> 1 + 1
<DeBot> ponga: 2
<ponga> hey you took lone
<jhass> yeah, I totally overload that server :P
<ponga> lol
waj has quit [Quit: Leaving.]
asterite_ has quit [Ping timeout: 246 seconds]
<ismaelga> >> "lol" * 3
<DeBot> ismaelga: "lollollol"
<ismaelga> cool
ponga has quit [Quit: Leaving...]
weskinner_work has quit [Ping timeout: 246 seconds]
waj has joined #crystal-lang
weskinner_mac has quit [Quit: weskinner_mac]
asterite has joined #crystal-lang
<asterite> I wonder if this works
<asterite> >> require "compiler/crystal/**"; Crystal::Parser.parse("foo { |x| x.bar }")
<DeBot> asterite: cc: error: .crystal/eval/Crystal5858Parser.o: No such file or directory
<asterite> :o
asterite has quit [Client Quit]
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
ponga has joined #crystal-lang
ismaelga has quit [Remote host closed the connection]
ismaelga has joined #crystal-lang
_whitelogger has joined #crystal-lang
waj has quit [Quit: Leaving.]
ismaelga has quit [Remote host closed the connection]
ismaelga has joined #crystal-lang
ismaelga has quit [Remote host closed the connection]
ponga has quit [Quit: Connection closed for inactivity]
havenwood has quit []
ponga has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
r0ast has joined #crystal-lang
r0ast has quit [Read error: Connection reset by peer]
r0ast has joined #crystal-lang
r0ast has quit []
DeBot has quit [Quit: Crystal]
jhass has quit [Quit: Bye]
jhass has joined #crystal-lang
leafybasil has joined #crystal-lang
orliesaurus has joined #crystal-lang
waj has joined #crystal-lang
waj has quit [Quit: Leaving.]
DeBot has joined #crystal-lang
waj has joined #crystal-lang
waj has quit [Quit: Leaving.]
asterite has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/xhbm
<crystal-gh> crystal/master 38f15d2 Ary Borenszweig: Fixed #461: Can't splat tuple in a [ ] method
<travis-ci> manastech/crystal#2081 (master - 38f15d2 : Ary Borenszweig): The build passed.
bcardiff has joined #crystal-lang
ismaelga has joined #crystal-lang
ismaelga has quit [Remote host closed the connection]
bcardiff has quit [Quit: Leaving.]
bcardiff has joined #crystal-lang
waj has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
Ven has joined #crystal-lang
<Ven> I never realized crystal had a channel on freenode :-)
<jhass> o/
<Ven> \o
<asterite> \o/
bcardiff has joined #crystal-lang
<asterite> \o/\o/\o/
<Ven> \o/o\o/
<jhass> >> (["o/", "\o"] * 10).join
<DeBot> jhass: Error in line 3: undefined method '*' for Array(String)
<jhass> :(
<Ven> ETOOCUTE :P
<asterite> Oh, so bad we don't have `*` for Array :(
<asterite> We have if for string though…
<asterite> >> "\o/" * 20
<DeBot> asterite: "o/o/o/o/o/o/o/o/o/o/o/o/o/o/o/o/o/o/o/o/"
<asterite> Right...
<jhass> wat
<jhass> oh, right
<jhass> >> puts "\\o/" * 20
<DeBot> jhass: \o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/
<asterite> :)
<asterite> >> require "compiler/crystal/**"; Crystal::Parser.parse("foo { |x| x.bar }")
<DeBot> asterite: cc: error: .crystal/eval/Crystal5858Parser.o: No such file or directory
<asterite> Any idea why that error?
<jhass> no :(
<jhass> ah, linking failed
<jhass> mh
<jhass> (you should print these to stderr maybe :P)
<asterite> Yes, but right now we use Process.run I think, which doesn't support stderr :(
<jhass> mine does :P
<asterite> Still have to decide on the pull requests, but we are on the middle of changing the evented stuff
<asterite> It seems we'll use libevent for now, goodbye libuv
<ponga> \(^o^)/
<Ven> is it normal that building the compiler is so cpu-intensive? :P
<jhass> yeah
<jhass> I'll run ^ through the syscall checker, bot will be broken for a while
<asterite> Ven: I think the cpu-intensive stuff is llvm compiling the files in parallel
<asterite> Like, my machine almost freezes for some seconds in that stage
<Ven> wow, I'll need to check options
havenwood has joined #crystal-lang
asterite has quit [Quit: Leaving.]
weskinner_work has joined #crystal-lang
asterite has joined #crystal-lang
<ponga> oh
asterite has quit [Quit: Leaving.]
<jhass> >> require "compiler/crystal/**"; Crystal::Parser.parse("foo { |x| x.bar }")
<DeBot> jhass: foo(&.bar)
asterite has joined #crystal-lang
<weskinner_work> >> require "compiler/crystal/**"; Crystal::Parser.parse("foo { |x| x.bar }").class
<DeBot> weskinner_work: Crystal::Call
<weskinner_work> >> require "compiler/crystal/**"; Crystal::Parser.parse("foo { |x| x.bar }").inspect
<DeBot> weskinner_work: "foo(&.bar)"
<asterite> :)
<asterite> It's working!
<weskinner_work> interesting
<asterite> The `to_s` doesn't know how you wrote the ASTNode but if i's a call with a block with a single argument, and a call on that argument, it writes it in the compact way :)
<jhass> asterite: http://paste.mrzyx.de/phmewq2li no idea
<weskinner_work> I like that it CAN .to_s
<weskinner_work> I need to read more of the complier :)
<asterite> weskinner_work: what do you mean with CAN .to_s ?
<jhass> that it doesn't just generate "<Crystal::Call 0x0123>" I guess
<asterite> :)
<asterite> The to_s on AST nodes isn't just for debugging purposes, it's used when you do {{some_node}} inside macros
<jhass> thought o
<jhass> *so
<weskinner_work> ahh
<weskinner_work> I need to read more about macros :)
<weskinner_work> I thought they were just find / replace
<jhass> asterite: that parse call starts an entirely new namespace I guess? I can't wrap a bunch of macro calling code into it to see what's coming out?
<jhass> Module#to_code would be interesting I guess :P
<jhass> even if "just" as a macro method
<asterite> require "compiler/crystal/**"; Crystal::Parser.parse("{{ foo.bar }}").inspect
<asterite> >> require "compiler/crystal/**"; Crystal::Parser.parse("{{ foo.bar }}").inspect
<DeBot> asterite: "{{ foo.bar}}"
<asterite> Ummm… the parser just returns nodes, it doesn't know anything about modules or semantic
<asterite> What would Module#to_code do, return the whole definition as an AST node? :)
<jhass> I mean like macro foo; 1+1; end; module Foo; foo; end; Foo.to_code #=> "module Foo\n1+1\nend"
<asterite> You'd use that for debugging purposes?
<asterite> I wonder what happens if you reopen the module. I think it would just dump the whole content
<asterite> The good thing about macros is that they are interpreted, and an interpret is so much easier to do than compiling stuff :)
<jhass> yes and yes
<asterite> and we can enhance it in whatever way we want :)
<jhass> especially if you start nesting macros or even nesting included/inherited hooks it can sometimes to help at the actual code generated
<jhass> the "make the macro fail" hack can only show so much
<jhass> *to look
<asterite> It's true
<asterite> I guess you would use it inside a macro call, like {{ puts Foo.to_code }}
<asterite> because you want that run at compile time (then at runtime you can access it with a macro def)
<jhass> yeah
<asterite> Ah, mmm… but in your previous example it wouldn't work
<asterite> the `1 + 1` doesn't get attached to anything in that module
<asterite> however, if it's a def, then yes
<jhass> what about module A; macro included; macro included; some_code; end; end; end; module B; include A; end; B.to_code?
<jhass> would it show the macro?
<jhass> "module B\nmacro included\nsome_code\nend\end" that is
<jhass> >> 3[1]
<DeBot> jhass: Error in line 3: undefined method '[]' for Int32
<jhass> ponga: ^ there, that would be fun, no? ;)
<ponga> what is it
<ponga> oh hey jhass
<jhass> just some bitshifting to extract the bit at the position
<jhass> >> 3.to_s(2)
<DeBot> jhass: "11"
<ponga> >> 3[1]
<DeBot> ponga: Error in line 3: undefined method '[]' for Int32
<ponga> >> 3.to_s
<DeBot> ponga: "3"
<ponga> >> 3.to_s(3)
<DeBot> ponga: "10"
<ponga> >> 3.to_s(1)
<DeBot> ponga: Sorry, that took too long.
<jhass> oO
<ponga> omg did i just help ya out
<ponga> lol
<jhass> >> 3.to_s(1)
<DeBot> jhass: Sorry, that took too long.
<jhass> asterite: bug, ^ hangs :D
<ponga> what's the number in bracket for to_s anyway?
<jhass> the base
<ponga> base like what, what math is it
<jhass> >> 16.to_s(16)
<DeBot> jhass: "10"
<jhass> the representation you're used to is base 10, aka decimal
<jhass> it uses the letters 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
<jhass> another base you might now is 16, hexadecimal, it uses 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
<ponga> ah
<ponga> decimal
<ponga> ok
<asterite> >> 3.bit(1)
<DeBot> asterite: 1
<jhass> oh, we just need an alias then :P
<asterite> It was originally [], but then if you accidentally have a number instead of an array, the code compiles
<asterite> which is ugly, it's bug prone, so I changed the name
<jhass> mmh
<asterite> like, an Int is not a collection of some sort
<asterite> (well, bits, but… mmm… bug prone)
<asterite> >> [1, 2, 3][4][5]
<DeBot> asterite: Error in line 3: undefined method '[]' for Int32
<asterite> (would work)
<ponga> would?
<asterite> If we added [] of Int
leafybasil has quit [Remote host closed the connection]
ismaelga has joined #crystal-lang
<jhass> asterite: looks like 3.to_s(1) hogs memory too :)
<asterite> Ah, in ruby it's just "invalid radix 1"
<jhass> mmh, why actually?
<asterite> Is it just a list of zeros?
<jhass> I'd say so
<asterite> Like, 3.to_s(1) #=> "000"
<jhass> yeah, "0"*self basically
<jhass> self+1
<asterite> I don't know if base 1 is something that exists
<jhass> 0 is 0 :P
<jhass> just dug out the same :D
<jhass> but how do you represent 0 I guess?
<asterite> I guess the repeated zero could work. That, or we leave the memory hog. In what other way we could get that behaviour with such a simple call?
<asterite> An empty string?
<jhass> dunno, maybe just raise too
ismaelga has quit [Remote host closed the connection]
<asterite> I think an empty string can wor
<asterite> k
<jhass> >> "".to_i(1)
<DeBot> jhass: 0
<jhass> >> "0".to_i(1)
<DeBot> jhass: 0
<jhass> the later would start returning 1 then :P
<jhass> *would need to
ismaelga has joined #crystal-lang
<jhass> yeah, raise seems actually reasonable :P
<jhass> raise "Do it yourself!" :P
<jhass> same for to_i(1)
<asterite> raise "Did you mean value * n?"
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/pv34
<crystal-gh> crystal/master 7d79d6f Ary Borenszweig: Fixed: check that (2 <= base <= 36) in String#to_i(base) and Int#to_s(base)
<jhass> <3
<asterite> <3 to you :)
<weskinner_work> how can the compiler call .map at compile time?
<ponga> what is <3
<jhass> ponga: shift it 90° counter clock wise
<ponga> jhass: still don't get it (´・ω・`)
<jhass> the macro language supports it
<jhass> ponga: *counter* clock wise
<ponga> jhass: still don't get it i said
<ponga> oh heart
<ponga> ok
<ponga> thanks
<ponga> always wondered..
<ponga> what that icecream corn is
<asterite> ponga: we originally tried to use the same crystal code to implement map and others, but it turns out it's quite hard (maybe impossible?) so instead we interpret those calls
<asterite> oh, sorry, that was for weskinner_work
<ponga> asterite: thank you for explaining that but that was for weskinner_work
<ponga> asterite: its good, i wondered that too
<weskinner_work> cool!
orliesaurus has left #crystal-lang [#crystal-lang]
<ponga> weskinner_work: are you at work at the moment
<travis-ci> manastech/crystal#2082 (master - 7d79d6f : Ary Borenszweig): The build passed.
<weskinner_work> ponga: yeah
shama has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ponga> weskinner_work: doing irc at work? what a swagger
_whitelogger has joined #crystal-lang
<travis-ci> manastech/crystal#2083 (master - 8902963 : Ary Borenszweig): The build passed.
<jhass> oh, wb _whitelogger
<jhass> :P
<crystal-gh> [crystal] asterite pushed 3 new commits to master: http://git.io/pfUp
<crystal-gh> crystal/master 6a02987 Jacob: Added BigInt#to_s(base)
<crystal-gh> crystal/master 3a2429d Jacob: Added BigInt#to_s(base)
<crystal-gh> crystal/master ce32fb4 Ary Borenszweig: Merge pull request #463 from Exilor/master...
<asterite> Yay, we have BigInt#to_s(base)… twice! :-D
<jhass> always make backups!
<travis-ci> manastech/crystal#2085 (master - ce32fb4 : Ary Borenszweig): The build passed.
<weskinner_work> ponga: what's a "swagger"?
<ponga> means you are cool
<weskinner_work> :D
<ponga> weskinner_work: i finished writing chapter 1 for my project! yay
<ponga> now browsing crsytal strlib
ismaelga has quit [Remote host closed the connection]
waj1 has joined #crystal-lang
waj has quit [Ping timeout: 252 seconds]
<weskinner_work> ponga: congrats! I'll have to check it out
<weskinner_work> ah nm doesn't look like it's on github
<weskinner_work> you said you were using gitbook?
<asterite> ponga: that the present is "is" and that in Esperanto it's "as" will sure confuse me, but I'll learn it anyway :)
<asterite> ponga: how do you say "I want to eat"?
<ponga> asterite: i haven't figured out how i want to execute auxiliary verbs in european languages
<ponga> i might add it as suffix
<ponga> its wholely style matter..
<asterite> All languages I know use the infinitive, I don't know if alis lang has that
<ponga> but i'd say mi manjis'or for now?
<ponga> that 'i would eat'
<ponga> asterite: it was in the issue, infinitive was -i which i believe is same in esperanto, but i decided to remove infinitive form
<ponga> and rather take just raw form
<ponga> infinitive do not exist in two languages i speak of, and same as article(a, an, the) its not critically a necessary feature for natural lang
<ponga> weskinner_work: https://www.gitbook.com/book/ponga/alis-language , yes it has a link in readme.md
<ponga> asterite: glad seeing someone speaking esperanto! ;)
<asterite> ponga: what two languages?
<ponga> korean/japanese
<ponga> my first/second tongue
bcardiff1 has quit [Quit: Leaving.]
<ponga> asterite: its not an artificial lang to replace existing ones like ido/esperanto, Alis lang is designed to you could talk to ai chatbot. So im omitting components i see unnecessary
<ponga> and plus whatever rule that makes a language more difficult without contributing linguistically
<ponga> actually semantically
vifino has quit [Quit: Who turned this off?! D:<]
<ponga> now time to completely rework mood pre/suffixes
<ponga> asterite: do you have a to-do list for crystal ?
<asterite> ponga: not really, kind of, in my head and what we talk with waj
<asterite> like, unfinished stuff that still need thought and resolution
<asterite> but that might be boring, so we do fun stuff and from time to time tackle the hard problems :)
<asterite> ponga: in japanese isn't there an infinite? like the "ru" form, taberu, iru, etc. (but I think they call it in another way)
wanderer has joined #crystal-lang
<weskinner_work> is "macro included" special?
<asterite> weskinner_work: yes
<weskinner_work> gets called on include?
<asterite> Yes, it's a macro that's invoken on include at compile time
<asterite> there you have @type, that's the type of the class/module that includes it
<weskinner_work> k just wanted to make sure
<jhass> weskinner_work: we also got macro inherited
<asterite> >> module Moo; macro included; $a = {{@type.stringify}}; end; class Foo; include Moo; end; $a
<DeBot> asterite: Syntax error in eval:7: expecting identifier 'end', not 'EOF'
<asterite> >> module Moo; macro included; $a = {{@type.stringify}}; end; end; class Foo; include Moo; end; $a
<DeBot> asterite: "Foo"
<jhass> heh, could just puts there directly :P
<asterite> module Moo; macro included; $a = {{@type.methods.map(&.name).sort.uniq }}; end; end; class String; include Moo; end; $a
<asterite> >> module Moo; macro included; $a = {{@type.methods.map(&.name).sort.uniq }}; end; end; class String; include Moo; end; $a
<DeBot> asterite: Syntax error in expanded macro: included:1: unterminated array literal
<asterite> Hehe, right
<asterite> >> {{ String.methods.map(&.name.stringify).sort.uniq }}
<DeBot> asterite: ["%", "*", "+", "<=>", "==", "=~", "[]", "[]?", "ascii_only?", "byte_at", "byte_index", "byte_slice", "bytes", "bytesize", "camelcase", "capitalize", "char_at", "chars", "chomp", "codepoint_at", "count", "cstr", "delete", "downcase", "dump", "dump_or_inspect", "each_byte", "each_char", "each_char_with_index", "empty?", "ends_with?", "gsub", "hash", ...
<wanderer> The website says "Latest entries from our blog:", does this mean that there are more? One can't tell as there doesn't seem to be a navigation
<asterite> wanderer: they are all, we should change the title
havenwood has quit []
<wanderer> asterite: ah, ok. yes, it's kinda unclear whether there are more entries or like some external blog with navigation
<jhass> >> String.allocate
<DeBot> jhass: ""
<jhass> core method
<jhass> copied from Ruby
<asterite> wanderer: fixed :)
<asterite> wow, didn't know String.allocate worked… pure luck
<jhass> weskinner_work: Class#new is basically def self.new(*args); obj = allocate; obj.initialize(*args); obj; end;
<jhass> asterite: hehe
<jhass> >> Array(String).allocate
<DeBot> jhass: []
<jhass> >> a = Array(String).allocate; a << ""
<DeBot> jhass: [""]
<jhass> \o/
<asterite> >> Array(String).allocate.buffer
<DeBot> asterite: Pointer(String).null
<asterite> :D
ismaelga has joined #crystal-lang
<asterite> Not initialized, so you were writing to memory address zero?
<asterite> weird
<jhass> weskinner_work: so it's dangerous since initialize doesn't get run ;)
<asterite> Yes. allocate is a primitive, meaning there's no source code for it
<jhass> well, there is, somewhere in llvm, no?
<weskinner_work> why is it useful here?
<wanderer> asterite: also I see Enumerable#include? got renamed to #includes?. why is that? and why not directly name it like e.g. #has?, i find #include? kinda strange to begin with
<jhass> weskinner_work: I should probably drop it, I had issue with initializers getting overriden and subclasses no longer accepting the json pull parser and stuff
<jhass> but changed architecture a bit since
<weskinner_work> ok so something specific to this setup not a general best practice for a certain situation
<jhass> yes, definitely not
<asterite> wanderer: `[1, 2, 3].include?(4)` reads strange, so we decided to rename it to `includes?`… but maybe both should be accepted. But I'm not sure `has?` has the same meaning
<asterite> Using allocate is never a best practice :)
<asterite> allocate is reserved for the compiler, but you might want to use it if you feel adventurous
<jhass> weskinner_work: you can see it sometimes in testsuites in ruby to trick out object initialization to make it faster or skip validations
<jhass> but I think it's also a bit safer there
<asterite> It's part of the "three unsafes" (R)
asterite has quit [Quit: Leaving.]
<weskinner_work> three unsafes?
vifino has joined #crystal-lang
<ponga> weskinner_work: asterite is gone
<weskinner_work> ah you're right
<jhass> he used that term in the past, let me search logs :D
<jhass> mmh, can no longer find it
<jhass> Class#allocate, pointers obviously
<jhass> can't remember the third
<ponga> i forked crystal and cloned it via github, now time to look for some work!
<ponga> getting used to git is lot of work
<jhass> ponga: went through try.github.com?
<ponga> jhass: thanks i always used sourcetree it'd be good of me to learn CLI git around
<jhass> if you got a good hour to spare, https://www.youtube.com/watch?v=1ffBJ4sVUb4 is awesome too
<crystal-gh> [crystal] Exilor opened pull request #464: Added BigInt::cast and #to_i, #to_u... (master...master) http://git.io/pJWK
<weskinner_work> jhass: I thought "three unsafes" might be some ruby thing. Not sure what asterite meant with the "(R)" suffix
<jhass> copyrighted
<jhass> as in a coorporate catch phrase
<ponga> uh what is -m -am after commit
<ponga> it doesn't explain
<jhass> ponga: message
<ponga> i see
waj1 has quit [Quit: Leaving.]
<jhass> if you leave it off git will open your $EDITOR instead to let it type you in
<jhass> the recommended format is to keep the first line below 70 characters and let it summarize the commit, if you want to add more to the message don't use the shortcut, add a blank line after the summary and continue in paragraphs with lines no longer than 80 characters
leafybasil has joined #crystal-lang
<weskinner_work> jhass: your architecture is quite impressive
<jhass> somewhat inspired by cinch and the aim to make two libraries out of it in the long run
<jhass> user tracking is still wonky and doesn't have its right place though
<weskinner_work> user tracking?
<jhass> keeping up to date what users are in the channel and which flags they got
<weskinner_work> ah. well thanks for your help today. will probably have more questions as I read through DeBot :) . Headed out!
<jhass> you're welcome, have a nice night
weskinner_work has quit [Ping timeout: 250 seconds]
ismaelga has quit [Remote host closed the connection]