<asterite>
The crash also probably happens if you use one of the built-in types at the top of the hierarchy: Object, Value, Reference, Struct
<asterite>
We need to fix that
<asterite>
Apart from that issue, the compiler is pretty solid... or at least we try to fix bugs as soon as we find them
<jhass>
mmh, I have the feeling that many methods would work with accepting any kind of Int, so restricting on Int would make sense to me
<jhass>
my naive idea would be to trace the calls and create copies of the method for each concrete type that's actually passed
<asterite>
Yes, for restrictions that's true, but for procs it's different because you need a function pointer in memory that can accept any kind of integer
<asterite>
(but methods with restrictions are instantiated when you invoke them, case by case, so that's the difference)
<asterite>
Trace the .call, right?
<jhass>
nah, just ignore that uninformed comment I guess :P
<asterite>
But your line of though is correct
<asterite>
only we tried (for a long time) to trace .call (and also trace Array#push) to avoid generic types, but it turned out to be impossible (in an efficient way)
<naps62>
I ended up with a couple of cases that fail, and two others that end up working for completely random reasons (or so it seems from my perspective)
<naps62>
And it seems the monkey patch didn't actually fix it
<naps62>
I still get the same "Adress already in use" error after I use Ctrl-C to quit the server
<naps62>
Probably back then it seemed to work because I just restarted the server without first making any actual requests to it
<asterite>
Thanks for the bug report!
<jhass>
mmh, maybe there needs to be an at exit handler that makes sure to close all connections
<naps62>
in the meantime, is there any way for me to manually close it?
<naps62>
Otherwise I have to wait a few seconds before starting the server again
zamith has quit [Quit: Be back later ...]
<jhass>
are @@class_vars local to a class? Even when I define them in a module that's included into the class? Or are they shared among the classes the module is included in?
<jhass>
I should just code up a test...
<asterite>
You can try this: Signal.trap(Signal::INT) { server.close; exit }
<asterite>
jhass: If you define them in a module and include them in a class, they are local to the class
<asterite>
(I just tried it. I'm not sure that's the way it should work, though, but class vars are not very used in our code yet, so...)
<jhass>
yeah, it's hard to overcome the instinct to not use them since Ruby made them so unusable
<asterite>
Hehehe, true. And in Ruby the code I tried does a different thing than Crystal
<jhass>
yes, handle @@class_vars in ruby like $globals
<jhass>
forget they exist
<jhass>
they're shared among the entire ancestry chain
<asterite>
Could be. But sometimes it's convenient to use @@foo because it's namespaces to wherever you are using them
<asterite>
but it's true that this needs more thought
<naps62>
I just noticed,does crystal have method overloading?
<naps62>
Also, new issue, I can't seem to use HTTP::Client
<naps62>
I just get a small stack trace, and a 256 exit code
<naps62>
I guess I'll open an issue for this as well
<jhass>
naps62: yep, crystal has method overloading
<jhass>
Could not raiseProgram terminated abnormally with error code: 1280
<jhass>
do I win a prize? :P
<naps62>
Nice
<naps62>
The thing this lacks the most is documentation, from what I can see
<naps62>
are you guys working on that, or thinking about it at least?
<jhass>
it's 5 btw, crystals autorunning is not good at determining the actualy error code
<jhass>
asterite: every seen Could not raise before?
<asterite>
Yes
<asterite>
It's either we are doing something wrong, or a bug in llvm/libunwind
<asterite>
There are some docs: crystal-lang.org/docs
<asterite>
jhass: is it a big code that triggers this?
<jhass>
quite
<asterite>
No, I still don't know how to debug that :(
<jhass>
threading maybe? does libunwind actually handle threads?
<asterite>
naps62: we are slowly working on things, but on our free time
<asterite>
But we are not many right now, so... it's slow
<asterite>
I don't know. The libunwind bug we have to patch to avoid this ( https://github.com/manastech/crystal/issues/327 ) seems to be related to unrooted back traces or something like that
<asterite>
but that patch only affects mac, it seems... so I don't know what's wrong
<asterite>
it's related to exceptions and libunwind's personality function
<asterite>
but... @waj did all of that, reading docs and blog posts spread all over the internet (but I didn't) so I don't know what could be the problem
<asterite>
Got to go now. But if you can reduce it to a small code, please submit a bug :-)
asterite has left #crystal-lang [#crystal-lang]
drizz_ has joined #crystal-lang
<naps62>
asterite: sure, not criticizing your work obviously :)
<naps62>
I hope I find the time do help a bit on my free time as well. This looks promising
drizz_ is now known as drizz
naps62 has quit [Ping timeout: 265 seconds]
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
shama has joined #crystal-lang
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
canhtak has joined #crystal-lang
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
tmoore_ has quit [Read error: Connection reset by peer]
endou______ has quit [Ping timeout: 276 seconds]
tmoore_ has joined #crystal-lang
endou______ has joined #crystal-lang
zamith has joined #crystal-lang
leafybasil has joined #crystal-lang
zamith_ has joined #crystal-lang
zamith has quit [Ping timeout: 244 seconds]
naps62 has joined #crystal-lang
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
zamith_ is now known as zamith
asterite has joined #crystal-lang
canhtak has quit [Quit: canhtak]
asterite has quit [Quit: asterite]
canhtak has joined #crystal-lang
asterite has joined #crystal-lang
bcardiff has joined #crystal-lang
<zamith>
asterite: hi
<asterite>
hi zamith
<zamith>
I'm trying to use frank to respond with an ecr template
<zamith>
but I'm not being able to
<zamith>
I get this stuff: __str__ << "\n\n \n \n \n
<asterite>
What’s your code?
<asterite>
(also note that frank is an experiment to try the language, we never used it seriously)
<asterite>
The idea is that you associate a view with a template, and call to_s on that viw
<asterite>
view
<zamith>
oh ok
<zamith>
and the template gets the instance variables, or just the ones with getters?
<asterite>
the template gets the instance variables too
<zamith>
then that getter in the example is not neede, right?
<asterite>
I just did it like that to make it more readable (maybe?)
<zamith>
*needed
<asterite>
Exactly
<zamith>
ok
<zamith>
thanks
<asterite>
The ecr_file macro creates a to_s(io) method that contains the template’s code
<asterite>
that’s done at compile time, so if you have a mistake in the template you will get an error (try it! for example change person.name to person.foo)
<asterite>
But that’s just one way to do templates
<asterite>
and we don’t have views and layouts yet (but we did some spikes and we can do it, with the same syntax as Rails, like content_for, yield, etc.)
<zamith>
btw, are you planning in having files .cr and .crs, now that you mention eleixir
<zamith>
*elixir
canhtak has quit [Quit: canhtak]
asterite_ has joined #crystal-lang
asterite has quit [Ping timeout: 244 seconds]
asterite_ is now known as asterite
<asterite>
I don’t think there would be a clearn distinction in crystal between .cr and .crs. In elixir it says “No bytecode file will be created” as the only difference (besides the intention)
rpag has joined #crystal-lang
leafybasil has joined #crystal-lang
leafybasil has quit [Ping timeout: 276 seconds]
<zamith>
basically it would be compiled, ran and then deleted, somthing like that
<asterite>
But that’s what happens when you do `crystal some_file.cr`
<zamith>
yeah, right
<zamith>
I was just checking if the spec were also included in the final binary
<zamith>
but I guess not, right?
<zamith>
*specs
<asterite>
Only what your code requires (and invokes) is compiled in the final binary
<zamith>
then that's cool
<zamith>
:)
naps62 has quit [Remote host closed the connection]
zamith has quit [Ping timeout: 256 seconds]
<asterite>
Yeah, that’s another thing I like. The binaries end up being very small (crystal itself is big because it has statically linked some libraries). And there’s no need for a dead-code elimination pass, or even to compile or check unused functions.
asterite has quit [Quit: asterite]
<rpag>
is there a 'rake' for crystal yet?
naps62 has joined #crystal-lang
naps62 has quit [Ping timeout: 246 seconds]
asterite has joined #crystal-lang
<jhass>
not that I noticed
<jhass>
you should write one! :P
<rpag>
that's why i asked =)
naps62 has joined #crystal-lang
<asterite>
jhass: you started writing one and ran into some issues, I can’t remember which ones
<jhass>
yeah...
<jhass>
the prelude thing I guess?
<jhass>
also no run_file macro, but that I worked around by shelling out
<asterite>
Yes, but I think that should be fixed by now because of the require
<asterite>
(the prelude thing)
<jhass>
yeah, maybe I should resurect that branch sometime
<jhass>
but if rpag takes that over now...
<jhass>
:P
<asterite>
:)
<asterite>
rpag: did you do pry?
naps62 has quit [Read error: Connection reset by peer]
naps62 has joined #crystal-lang
<naps62>
Hey there
<naps62>
I was trying to add a "local" method to the Projectfile DSL, to fetch dependencies in your file system
<naps62>
is this an interesting feature, or is it intentionally left out for some reason?
<asterite>
I think it’s interesting, so you can develop two libraries at the same time or have a copy of one and do patches to it before having to push it to use it (similar to Gemfile’s path)
<asterite>
It’s left out only because we didn’t have time to do it yet
<asterite>
so it would be awesome to have it :)
<asterite>
(there’s also bundler’s local path thingy we could do, but that’s a change in the compiler, I guess)
<naps62>
One issue though
<naps62>
I'm having trouble compiling the compiler
<naps62>
I added a Makefile.local with "threads := 2"
<naps62>
but I see a lof of crystal processes anyway, and my laptop eventually hangs
<asterite>
Hmm… strange
<asterite>
If you run all specs it works?
<asterite>
(in any case, you don’t need to compile the compiler to add that feature you want)
<naps62>
Yes, but it's the only way for me to manually test it right?
<naps62>
well, "make spec" gives me a "forl: cannot allocate memory"
<naps62>
*fork: cannot allocate memory
<naps62>
it seems to be spawning a lot of processes
<asterite>
You can do `crystal src/crystal/project_cli.cr` to try the Projectfile
<asterite>
What happens if you use one thread?
rpag has quit [Quit: Leaving]
<naps62>
same thing, it just keeps spawning processes
<naps62>
looking at the size of the list, I'm guessing it just spawns them forever, until it runs out of memory
<naps62>
perhaps a linux issue like the one with the constant yesterday?
<asterite>
If you do `bin/crystal build src/compiler/crystal.cr` the same happens?
asterite_ has joined #crystal-lang
asterite has quit [Ping timeout: 255 seconds]
asterite_ is now known as asterite
bcardiff has quit [Quit: Leaving.]
<naps62>
I just reinstalled crystal (using the one from AUR) and now it works
<naps62>
even though this is suposedly using the local crystal binary, and not the system one
naps62 has quit [Ping timeout: 246 seconds]
asterite has quit [Quit: asterite]
asterite has joined #crystal-lang
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
asterite has quit [Quit: asterite]
asterite has joined #crystal-lang
asterite has quit [Client Quit]
asterite has joined #crystal-lang
naps62 has joined #crystal-lang
rpag has joined #crystal-lang
bcardiff has joined #crystal-lang
leafybasil has joined #crystal-lang
asterite has quit [Quit: asterite]
bcardiff1 has joined #crystal-lang
bcardiff has quit [Read error: Connection reset by peer]
leafybasil has quit [Remote host closed the connection]
rpag has quit [Quit: Leaving]
r20 has joined #crystal-lang
seb_ has joined #crystal-lang
<seb_>
Hey, it doesn’t appear that crystal support a “=“ method. e.g. class Hello
<seb_>
sorry
zamith has joined #crystal-lang
<seb_>
for example a method like this: def =(some_value)
<seb_>
do we think it will support a method called “=“ in he future?
<jhass>
ruby does neither, what would it do?
<jhass>
I mean that totally conflicts with local variable assignment, wouldn't it?
<seb_>
yeah you’re right
<seb_>
but I guess it supports a method called “==“ for example