jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.5.8 | 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
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
tymat has quit [Remote host closed the connection]
tymat has joined #crystal-lang
tymat has quit [Remote host closed the connection]
tymat has joined #crystal-lang
canhtak has quit [Quit: canhtak]
bcardiff has joined #crystal-lang
zamith has quit [Quit: Be back later ...]
bcardiff has quit [Quit: Leaving.]
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jhass is now known as jhass_
jhass_ is now known as jhass
CeBot has quit [Quit: Crystal]
CeBot has joined #crystal-lang
CeBot has quit [Client Quit]
CeBot has joined #crystal-lang
CeBot has quit [Remote host closed the connection]
CeBot has joined #crystal-lang
canhtak has joined #crystal-lang
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
Liothen has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
leafybasil has quit [Ping timeout: 240 seconds]
leafybasil has joined #crystal-lang
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
canhtak has quit [Quit: canhtak]
zamith has joined #crystal-lang
canhtak has joined #crystal-lang
asterite has joined #crystal-lang
asterite has quit [Quit: asterite]
asterite has joined #crystal-lang
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1840 (master - 6e28a4c : Ary Borenszweig): The build passed.
travis-ci has left #crystal-lang [#crystal-lang]
asterite has quit [Ping timeout: 255 seconds]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
sferik has joined #crystal-lang
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
bcardiff has joined #crystal-lang
asterite has joined #crystal-lang
asterite has quit [Ping timeout: 264 seconds]
<jhass> GC Warning: Repeated allocation of very large block (appr. size 134221824):
<jhass> May lead to memory leak and poor performance
<jhass> oh well
bcardiff1 has joined #crystal-lang
bcardiff has quit [Ping timeout: 264 seconds]
bcardiff1 has quit [Quit: Leaving.]
asterite has joined #crystal-lang
bcardiff has joined #crystal-lang
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
asterite has quit [Quit: asterite]
sferik has joined #crystal-lang
canhtak has quit [Quit: canhtak]
<zamith> jhass: where's that written?
<jhass> while compiling
asterite has joined #crystal-lang
<jhass> asterite: got some time for some remote debugging? :P
<jhass> I'm getting:
<jhass> GC Warning: Repeated allocation of very large block (appr. size 67112960):
<jhass> May lead to memory leak and poor performance.
<asterite> Not right now, I have a series of meetings today :(
<jhass> repeatedly and I have to kill the compiler
<jhass> just quick tip where I could insert some debug statements maybe?
<asterite> Oh, it’s when you compile some code?
<jhass> yes
<asterite> Mmm… I can’t think of a place
asterite has quit [Quit: asterite]
<jhass> alright, I try to attach a gdb
shama has joined #crystal-lang
asterite has joined #crystal-lang
<asterite> We definitely need to implement the debugger
<asterite> Well, correctly emit debug info
<jhass> what's --debug doing currently?
<asterite> It’s emiting some debug info, but I think it’s broken. I think it broke when we started using llvm 3.5
<jhass> mmh, it slows down compiling the compiler a lot though
<asterite> I guess. The debug info is very big and verbose
canhtak has joined #crystal-lang
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
asterite has quit [Quit: asterite]
asterite has joined #crystal-lang
bcardiff1 has joined #crystal-lang
bcardiff has quit [Ping timeout: 276 seconds]
leafybasil has quit [Remote host closed the connection]
<jhass> kay, had to kill that, it won't finish. asterite if you got some time pls ping me, I'm pretty clueless on this one
leafybasil has joined #crystal-lang
<asterite> jhass: mmm… do you have some code I can try to debug?
<asterite> Or, when did it start happening?
<jhass> okay, I just isolated it
<jhass> trying to reduce it, but not successful
<jhass> so, maybe the background story
<asterite> What bakcground story?
<jhass> of the bug ; I had a class with lots of parameters in initialize, basically all of them with constructor assignment to ivars
<jhass> I wanted to refactor those params into their own object
<jhass> so before changing the API, I just would build sad object in the constructor
<jhass> in the process I removed one of instance variable assignments in the constructor
<jhass> and I didn't see that I'm still referenced it in another method
<jhass> and that strangely caused the bug
zamith has quit [Quit: Be back later ...]
<jhass> removing the reference fixed it
<jhass> and no, it doesn't reproduce on a minimal example
<asterite> But it’s too big to share?
<jhass> it's quite big, yeah :/
<asterite> It’s part of CeBot?
<jhass> yeah
<asterite> Hmmm… was that object a struct?
<jhass> nope
<asterite> I mean, the replacement for the many variables
<asterite> Ah
<asterite> It’s using the record macro?
<jhass> nope
<asterite> Ok :)
<asterite> If it was a struct maybe you ended up with a struct that contains itself, I think that blows the compiler
<asterite> (but I’m not sure)
<jhass> I don't think it's actually related to the object
<jhass> the ivar was called @user
<jhass> I literally can comment in and out @user = "foo" in the constructor to trigger it
<asterite> Will CeBot source code be public one day?
<asterite> I’m just curious why you don’t open source it
<asterite> (but, of course, that’s your decision. The good thing about crystal is that you can create apps without giving the source code :-P)
<jhass> sure
<asterite> (good/bad)
<jhass> I want to get it out of the total mess state first though ;)
<asterite> Oh, I wouldn’t worry about that :)
<asterite> As long as it works, the code doesn’t matter that much (at least that’s the way I see things)
<asterite> Of course I also try to make code readable and easily changeable, but that’s secondary
<jhass> well, I designed it so that eventually actually two libraries will fall out of the project
<jhass> one that abstracts the basic IRC stuff and one that builds a nice API for writing a bot on top
<jhass> they're a bit tangled still, so I want to have at least the basic feature set ready so I know I don't radically need to change the design anymore
<jhass> we'll see
<jhass> if I can get SASL working today, maybe I'll make a repo
<asterite> Cool :)
<jhass> asterite: yay, could reduce it
<jhass> you'll hate me :P
<asterite> Nice!
<asterite> I don’t know why you say “you’ll hate me”. The more bug reports you send and I (hopefully fix), the less bugs others will find :)
<jhass> because I come up with those super weird constructs all the time? :D
<asterite> Hahaha, yes, you really try to explote all the possibilities the languages gives you
<asterite> Or at least the possibilites you think the language will give you :-P
<asterite> For me it also hangs when I have: def send type, *parameters
<jhass> ah, k, I stoppped reducing tbh
<jhass> yesterday I temporarily had class Foo(T); def foo; T.new; end; end;.... :D
<asterite> That works, right?
<jhass> yes
<jhass> I wanted to pass dynamic arguments to that then
<jhass> that no longer worked out ;)
<jhass> so I went with passing a proc that constructs the object on demand
<jhass> what I wanted to ask is whether there is/you thought of something like Ruby's Module#included
<asterite> It’s already here
<asterite> well, kind of :)
<asterite> I’ll give you a gist
<jhass> oh cool
bcardiff1 has quit [Quit: Leaving.]
<asterite> There’s also inherited for classes
<asterite> Basically, `macro included` is a special macro that gets executed on the including type
<asterite> and you have the macro variable @type there
<jhass> hah, exactly what I thought of
<jhass> awesome, thanks
<asterite> Ideially it should be `macro included(including_type)`, we’ll do that in a future release I guess (more intuitive maybe)
<asterite> :)
<asterite> I used it in a small project to automatically collect subclasses of a class
<asterite> It’s not documented anywhere, though
<jhass> I just want to add a bunch of class methods ;)
<asterite> Good. I hope you can do it with the limited macro funcionality we have
zamith has joined #crystal-lang
<jhass> mmh, do you prefer def new a : A; new a.b; end; def initialize b : B; end; or def initialize a : A; initialize a.b; end; ...?
<jhass> *def self.new of course
<asterite> I prefer to have few (possibly one) initialize and then self.new that invoke new
<asterite> So I guess the first one
<asterite> It’s like “initialize” is the main way to create a method, “new” are convenience methods
<asterite> but it’s a fine line between new and initialize
<jhass> k, thanks
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
asterite_ has joined #crystal-lang
canhtak has quit [Quit: canhtak]
asterite has quit [Ping timeout: 265 seconds]
asterite_ is now known as asterite
canhtak has joined #crystal-lang
bcardiff has joined #crystal-lang
<asterite> So, #361 is because of an infinite tuple expansion
<asterite> (the restriction there doesn’t have any effect, I will change it to be a parse error)
<asterite> so first its send(String, Nil)
<asterite> then send(String, Array(Nil))
<asterite> then send(String, Array(Array(Nil))
<asterite> and so on
<asterite> I think I can try to detect that… I’ll try :)
<jhass> would be awesome because I managed to reintroduce it and I just don't see where
<jhass> :)
<asterite> Check that if you call a method with a splat from that same method that you have another method with a resrtiction for that arg
<jhass> right, thanks
<asterite> I think I have the fix. If you want I can push and you can try and see if it catches the error you just had
<jhass> mmh, I already fixed it though :P
<jhass> was indeed passing a String? where I wanted to pass String
<asterite> Ah, ok. I’ll push the fix anyway. I’m not sure it will give some false positives, but I think not
canhtak has quit [Quit: canhtak]
<jhass> I'll probably complain soon enough if so :P
asterite has quit [Quit: asterite]
<jhass> >> %r(//)
<CeBot> jhass: ////
<jhass> >> %r( \s*//)
<CeBot> jhass: / s*///
<jhass> mmh
<jhass> >> %r(\s*//)
<CeBot> jhass: /s*///
canhtak has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
zamith has quit [Quit: Be back later ...]
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sferik has joined #crystal-lang
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zamith has joined #crystal-lang
<zamith> jhass: The parser isn't doing any escaping on %r, just putting whatever you passed in inside a regex, from what I could understand
canhtak has quit [Quit: canhtak]
<jhass> My point is that it's unexpected then
<zamith> sure
<zamith> looking into it
<jhass> cool!
asterite has joined #crystal-lang
canhtak has joined #crystal-lang
canhtak has quit [Client Quit]
<asterite> zamith: in case you are looking into it, I found the problem (it was really easy). The culprit is this line: https://github.com/manastech/crystal/blob/master/src/compiler/crystal/syntax/lexer.cr#L1550
<asterite> I guess that remained from the time we didn't have %r(...) be a regex
<zamith> what does that do?
<zamith> can I just remove it?
<asterite> I already fixed it :blush:
<zamith> ok
<zamith> is it on master
<zamith> ?
<asterite> It was checking that if the delimited thing must end with '/' then it's a regex and all '\' mean "escape char"
<asterite> Yes
<asterite> Sorry, I fixed it and then saw in the chat that you was doing it
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1842 (master - 3cb023b : Ary Borenszweig): The build passed.
travis-ci has left #crystal-lang [#crystal-lang]
asterite has quit [Quit: Page closed]
<zamith> no problem
<zamith> I'm trying to improve the tests a bit
<zamith> how can I create a private getter?
<zamith> is it "private getter", or "private\ngetter", as it would be in ruby
<zamith> ?
<jhass> why make an getter if it's not public?
<zamith> so that I can access instance variables as methods, instead of directly
<zamith> so that it is always sending a message, instead of accessing data
<zamith> this is a Sandi Metz "trick"
canhtak has joined #crystal-lang
<zamith> she covers it in more detail in POODR
<jhass> I love indirection, not sure about that one though :P
<zamith> she has some good arguments, you should read it
<zamith> ;)
<zamith> but I have discussed this at length and came to the conclusion that is mostly a question of taste
<zamith> it also makes it easier to extract methods into classes and make some of the variables instance variables
<zamith> if you have a private getter, you don't even have to change the name of the variables
CeBot has quit [Quit: Crystal]
CeBot has joined #crystal-lang
sferik has joined #crystal-lang
sferik has quit [Client Quit]
sferik has joined #crystal-lang
zamith has quit [Quit: Be back later ...]