<Davy_CC>
but why you need to create an another function inside a function?
<Davy_CC>
if you are inside a Class, you can define a private method for the recursive method `bar`, like this https://carc.in/#/r/tt2
umurgdk has joined #crystal-lang
<zeno_>
I want to transform nested loop to tail recursion.
zeno_ has quit [Quit: 离开]
zeno_ has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
umurgdk has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
fka has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
fka has quit [Ping timeout: 260 seconds]
zeno_ has quit [Ping timeout: 248 seconds]
bjz has joined #crystal-lang
zeno_ has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 240 seconds]
zeno_ has quit [Ping timeout: 276 seconds]
zeno_ has joined #crystal-lang
zeno_ has quit [Read error: Connection reset by peer]
ponga has joined #crystal-lang
Philpax has quit [Ping timeout: 260 seconds]
Philpax has joined #crystal-lang
Philpax has quit [Ping timeout: 260 seconds]
fka_ has joined #crystal-lang
zeno_ has joined #crystal-lang
trapped has joined #crystal-lang
bjz has joined #crystal-lang
fka_ has quit [Read error: Connection reset by peer]
fka_ has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
bjz_ has quit [Ping timeout: 248 seconds]
trapped has joined #crystal-lang
umurgdk has joined #crystal-lang
<yxhuvvd>
zeno: that ruby snippet probably doesn't do what you think it does.
<yxhuvvd>
as foo and bar end up defined in the same scope. Meaning that you can do something.foo, followed by something.bar
umurgdk has quit [Ping timeout: 240 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<jhass>
JX7P: it tries to solve as much as possible of the method dispatch at compile time, but there's a small runtime dispatch in case it's not possible
<jhass>
zeno_: while Ruby allows you to nest method definitions, I'm quite certain it doesn't do what you think it does and is bad style there too
<jhass>
oh, yxhuvvd already pointed out
trapped has quit [Read error: Connection reset by peer]
mondok has joined #crystal-lang
umurgdk has joined #crystal-lang
mondok has quit [Ping timeout: 268 seconds]
zeno__ has joined #crystal-lang
zeno__ has quit [Client Quit]
zeno_ has quit [Remote host closed the connection]
zeno_ has joined #crystal-lang
alsm has joined #crystal-lang
ready has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<zeno_>
Ehhhhhhh, I wrote Python before, define a function in another means to create a closure in Python, maybe I have to change my thought.
<jhass>
yes, does not happen in ruby and is just not valid in crystal
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<JX7P>
is it not true that Crystal uses message despatch?
Philpax has joined #crystal-lang
<jhass>
JX7P: see above?
nulpunkt has left #crystal-lang [#crystal-lang]
<JX7P>
jhass, i cannot see anything above
<JX7P>
luckily i found that IRC log thing and thank you, i have now the answers i sought
zeno_ has quit [Ping timeout: 264 seconds]
petercommand has joined #crystal-lang
Gasher has joined #crystal-lang
fka__ has joined #crystal-lang
fka_ has quit [Read error: Connection reset by peer]
Tophe has joined #crystal-lang
<Tophe>
hi all, I need help to install chrystal. I am having trouble fetching the ppa key on ubuntu.
<jhass>
JX7P: I'm not certain but I think it's neither but rather the compiler determines all candidates at compile time and generates a small if/else like dispatch among them
<jhass>
Tophe: huh, don't you need to call apt-key?
<JX7P>
how does this affect the ability to have objects respond to arbitrary messages?
Gasher has quit [Ping timeout: 276 seconds]
<JX7P>
or even to change their responses at runtime, add new messages they may respond to, and so on
<jhass>
there's no runtime reflection at all
<JX7P>
oh no
<jhass>
crystal rather focuses on a powerful macro system that's evaluated at compile time
<JX7P>
that is a tragedy in the same league as MRI's parser.y
<jhass>
just your opinion ;)
<JX7P>
it is a tragedy
<JX7P>
i will have to investigate techniques that might enable its re-addition
<JX7P>
granted, it does somewhat interfere with full static safety (how much knowledge must the compiler have short of executing the programme to determine type errors with a highly reflective programme?)
<jhass>
I actually quite like to have to design stuff without it
<jhass>
often leads to faster and cleaner systems
<jhass>
not only somewhat
<JX7P>
it was what caused me to become ill of C++
<jhass>
it heavily influences global type inference and physical object representation
<jhass>
do have a look at the macro system
<JX7P>
so much typing and tomfoolery, i just wanted to jump off a bridge, it was a tragedy. yes, i think the macro system will be interesting, thank you for your kind answers
brunto has joined #crystal-lang
<Tophe>
so, it work on my computer (ubuntu 14.01) I have to do some manipulation to load the key, because of incompatibility issues.
<Tophe>
gpg2 --export -a 09617FD37CC06B54 > chystal.asc
<Tophe>
apt-key add chystal.asc
Gasher has joined #crystal-lang
<jhass>
pretty sure apt-key adv --keyserver keys.gnupg.net --recv-keys 09617FD37CC06B54 works on 14.01, I think you rather happened to hit a better server the second time
<BlaXpirit>
what is 14.01
<BlaXpirit>
Tophe, please clarify ubuntu version, this is not a valid one
<Tophe>
sorry 14.04 (last lts)
trapped has joined #crystal-lang
<asterite>
jhass: you are correct, method dispatch is just a chain of if/elsif. Later LLVM might optimize that into a jump table :-)
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: https://git.io/v2hTH
<crystal-gh>
crystal/master 876aaab Ary Borenszweig: Hierarchy tool: show in bold instance variables that have a fixed type
<jhass>
well then you simply hit a current limitation of the language now
<umurgdk>
ehehe :)
<jhass>
I guess given you require whatever T is to implement map, you could try toying with requiring Enumerable(T) or something
<asterite>
umurgdk: what's the type of item in select_map?
<umurgdk>
It depends on the given parser type
<umurgdk>
if Parser(Array(Int32)) then it should be Int32
<asterite>
A Parser always deals with Array?
<umurgdk>
nope
<Tophe>
is there a way to do binary marshalling, like ruby marshall ?
<asterite>
Tophe: not yet
<BlaXpirit>
Tophe, at least you can get a json-like data structure and pass it through msgpack
<Tophe>
ok, that's a good way to start, but json/msgpack have some drawback, harder to use, and support a small type subset (no date for example)
bcardiff has joined #crystal-lang
<BlaXpirit>
Tophe, sure
<Tophe>
asterite: what's you have started is incredible ! perhaps ruby can survive to the go effect afterall.
<asterite>
I don't think Ruby will die, even with Crystal around. You can do many things with Ruby that you can't do with Go or Crystal
<Tophe>
sure, ruby is so cool (but it is also so slow) and also so magic, that some time it is incredibly hard to read. (I love it)
<JX7P>
Tophe, what do you mean by 'go effect'
<JX7P>
restrictive, limited languages that misunderstand what semicolons are for, and whose propagandists urge the use of M4 Macro Maker for generics?
<fka__>
hey all!
fka__ is now known as fka
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: https://git.io/v2hBz
<crystal-gh>
crystal/master 7545084 Ary Borenszweig: Formatter: correctly reindent heredocs. Related to #2282
<Tophe>
JX7P : I mean that if you use ruby and need to scale and have webpages running in less than 500ms, you need to find a new language to do that. Because the concurency model of ruby can't scale well. so you can try different language (elixir but need a good functional programming level, node + js, Go ...) and Go is perhaps the most simple to learn for rubyist, and have good performances, low memory usage ! (excluding crystal which must be the obvious
<fka>
@bcardiff hey! you had a great update on kamber.
<fka>
thanks!
knoopx has quit [Remote host closed the connection]
<fka>
i'm waiting for your PR!
<bcardiff>
It wasn't me :-). I am just linking a post that deals with the diff between latest crystal and kamber and kamber's author. May be the post's author will do it.
<bcardiff>
it would be great to have someway to trigger travis over each crystal shards now that crystal releases might be evolving faster than some projects.
<plukevdh>
asterite: given your suggested changes from Friday, I get the following when casting to a recursive type: https://play.crystal-lang.org/#/r/tui
<bcardiff>
Until the crystal reaches 1.0 it is hard to keep all projects up to date. All shards suffer from that right now.
<plukevdh>
{"add" => {"headers" => }
<plukevdh>
which isn't even a valid object
<plukevdh>
walking the object down to the "headers" key ends up yielding a segfault
<fka>
@bcardiff aha! thanks for linking then :) i loved it.
<bcardiff>
@fka welcome :-)
<umurgdk>
jhass: ok maybe the map function is not necessary at all
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: https://git.io/v2jKQ
<crystal-gh>
crystal/master 74fbe56 Ary Borenszweig: Run `crystal tool format` to upgrade to new syntax
<crystal-gh>
crystal/master fc76020 Ary Borenszweig: Removed the syntax `def foo(x = V : T)`, and updated code to emit the new syntax: `def foo(x : T = V)`
bcardiff has quit [Ping timeout: 264 seconds]
bcardiff_ is now known as bcardiff
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
alsm has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
sp4rrow has joined #crystal-lang
<travis-ci>
crystal-lang/crystal#fc76020 (master - Removed the syntax `def foo(x = V : T)`, and updated code to emit the new syntax: `def foo(x : T = V)`): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/114335373
pawnbox has quit [Ping timeout: 250 seconds]
bcardiff has quit [Quit: bcardiff]
<trapped>
jhass: thanks for the support
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
<jhass>
trapped: purely egoistic ;P
sp4rrow has joined #crystal-lang
pawnbox has joined #crystal-lang
<trapped>
jhass: you're using artanis in carc.in, right?
<jhass>
yep
alsm has quit [Ping timeout: 276 seconds]
pawnbox has quit [Ping timeout: 240 seconds]
Philpax has quit [Ping timeout: 276 seconds]
alsm has joined #crystal-lang
slash_nick is now known as slash_quit
mondok has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
trapped has quit [Ping timeout: 240 seconds]
LW___ has quit [Ping timeout: 260 seconds]
pawnbox has quit [Ping timeout: 240 seconds]
alsm has quit [Ping timeout: 260 seconds]
LastWhisper____ has joined #crystal-lang
trapped has joined #crystal-lang
bjz has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
mondok has quit [Ping timeout: 240 seconds]
pawnbox has quit [Ping timeout: 240 seconds]
LastWhisper____ has quit [Remote host closed the connection]
LastWhisper____ has joined #crystal-lang
<sp4rrow>
is there any news on the compiler rewrite?
fka has quit [Remote host closed the connection]
<jhass>
it's put aside for now
<jhass>
they want to focus to bring the features achieved by it to the language first and then look at it again
<sp4rrow>
awesome that sounds good
<sp4rrow>
is there any profiling data on the compiler?
<jhass>
what do you mean?
<sp4rrow>
well part of the reason is because the compiler was slow
<sp4rrow>
I was curious what is slow
<jhass>
it's not that slow
<jhass>
fast enough for the size of projects currently in existence
<sp4rrow>
ah
<sp4rrow>
yeah but in the new years article wasnt there something about it being too slow for large sized projects moving forward
<jhass>
well, that's extrapolations ;)
<sp4rrow>
cool
<sp4rrow>
that is awesome to know
<sp4rrow>
curious
<sp4rrow>
is there any performance libs for crystal
<sp4rrow>
even in the program I build
slash_quit is now known as slash_join
<jhass>
I don't follow
<sp4rrow>
something like rubyprof
<jhass>
oh you mean profiler
<sp4rrow>
yeah :)
<jhass>
you can try the usual profilers you'd use for C too
<jhass>
perhaps try if compiling with -d makes the output any more useful for you
<sp4rrow>
interesting I have not used a c compiler
bcardiff has joined #crystal-lang
<sp4rrow>
I have used dtrace a long time ago
<sp4rrow>
can you use the xcode profiling tools
<sp4rrow>
they are build around llvm right?
<jhass>
I don't use OS X, don't ask me ;)
<jhass>
but I guess so
<jhass>
you can use them I mean, I doubt they have to integrate with LLVM in any way, at least I don't follow how that'd make any sense
pawnbox has joined #crystal-lang
A124 has quit [Quit: '']
<sp4rrow>
I was reading something about swift a while back about how the profiling and dev tools work because of llvm
<sp4rrow>
at least what I gleaned is that things that run with llvm integrate into OSX dev tooling
A124 has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
<JX7P>
oh, yes, the apple people take LLVM very seriously so they do
<sp4rrow>
well I am super curious I am going to try and get a profiler working in general
bcardiff has quit [Ping timeout: 260 seconds]
plukevdh has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
luislavena has joined #crystal-lang
pawnbox has joined #crystal-lang
Philpax has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
shadeslayer has quit [Ping timeout: 260 seconds]
shadeslayer has joined #crystal-lang
LastWhisper____ has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]