<asterite>
I guess we can change MatchData's inspect
<jhass>
not what I was testing
<jhass>
DeBot: !hangman ruby
<DeBot>
␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣ [] 0/12
<jhass>
DeBot: #
<DeBot>
␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣ [#] 1/12
<jhass>
DeBot: :
<jhass>
:/
<jhass>
ah, I see why
<jhass>
DeBot: a:
<DeBot>
␣␣␣::␣␣␣␣::␣␣␣␣␣␣␣␣ [#a] 2/12
<asterite>
DeBot: e
<DeBot>
␣e␣::␣␣␣␣::␣␣e␣␣␣␣␣ [#a] 2/12
<jhass>
DeBot: eiuo
<DeBot>
␣e␣::␣O␣␣::u␣e␣␣␣␣␣ [#ai] 3/12
<asterite>
What's that?
<jhass>
good question :D
<jhass>
DeBot: Pnm
<DeBot>
Ne␣::POP␣::u␣e␣␣␣␣␣ [#aim] 4/12
<jhass>
DeBot: t
<DeBot>
Net::POP␣::u␣e␣␣␣␣␣ [#aim] 4/12
<jhass>
DeBot: 3
<asterite>
lol :-P
<jhass>
meh, didn't whitelist numbers
<asterite>
Ruby classes and methods?
<jhass>
yeah
<asterite>
:)
DeBot has quit [Quit: Crystal]
DeBot has joined #crystal-lang
<shadeslayer>
heh that's pretty neat
wanderer has joined #crystal-lang
<wanderer>
Hi, I get the crash log "Nil assertion failed", the backtrace contains something with Bool, CodeGen#visit and something with Var+ when using the compiler, what's the best way to debug this now? the log doesn't really helped me so far
<jhass>
wanderer: on compile?
<wanderer>
yes, I'm trying to compile the compiler
<jhass>
uh
<jhass>
I suppose you changed something in it/stdlib? got the diff between the last working version maybe?
<wanderer>
jhass: no, I'm not at home atm and yes, I've changed something in stdlib
<jhass>
you probably found a compiler bug
ismaelga has joined #crystal-lang
<wanderer>
is there some way to get a better backtrace with line numbers and stuff, or.. well
<jhass>
and to debug this we need the code that caused it :/
<wanderer>
I don't even know where it goes wrong
<wanderer>
on windows I'd use OllyDbg
<jhass>
got the whole trace?
<wanderer>
but as for this I have no clue where to start searching
<wanderer>
as soon as I get home I can paste it
<wanderer>
I've changed multiple smaller things in the stdlib for testing and messing around
<asterite>
On what os?
<wanderer>
I'm using crystal on Ubuntu
<asterite>
The problem is that the compiler uses the std, so if you broke something in the std then that might break the compiler in many ways
<asterite>
You can try running the specs first, which also test the compiler
<asterite>
As for debugging that, the debugging support is non-existent right now :(
<wanderer>
the first line says "Nil assertion failed", then there are like 3 lines that contain something with Bool and then there's a whole bunch of CodeGen calls with #visit, Var+ and such
<asterite>
Unless we have the full backtrace (or at least those lines) and the changes you made, there's no way we can know what's wrong
<wanderer>
can I somehow get the line numbers?
<jhass>
yeah sorry, we'll need the code to cause it or at least the full error, "something with" is useless
<jhass>
not anymore since you didn't compile the compiler with --debug
<wanderer>
that's what I thought
<wanderer>
so I'll recompile the compiler with --debug and test it again
<wanderer>
then I would get a better crash log?
<jhass>
uh, I don't remember if libunwind reads them
<jhass>
but worth a try
<wanderer>
k, I'll paste it here, too, later
<asterite>
I think you then use addr2line or something like that
havenwood has joined #crystal-lang
weskinner_work has left #crystal-lang [#crystal-lang]
<wanderer>
btw what ways are there to create static arrays?
<wanderer>
dynamic arrays are created with [] of String, correct?
<asterite>
Yes
<asterite>
You can create static array with new: StaticArray(Int32, 8).new(0)
<asterite>
>> StaticArray(Int32, 8).new(0)
<DeBot>
asterite: [0, 0, 0, 0, 0, 0, 0, 0]
<asterite>
>> StaticArray(Int32, 8).new { |i| i * 2 }
<wanderer>
asterite: thx, are there more possibilities?
<asterite>
I don't think so… unless you define new `new` methods on it :)
<asterite>
What do you need to do?
<wanderer>
also, where does this :: syntax actually come from?
<asterite>
Mmm… the language
<asterite>
Or do you mean, why did we use that?
<wanderer>
atm nothing, yesterday I was testing around a little and I was a kinda confused how I get what I actually want, due to all those different syntax possibilities
<wanderer>
yes
<wanderer>
there is no such thing in ruby, is there?
<asterite>
No, because in Ruby you don't need to declare uninitialized static arrays to efficiently implementing IO
<asterite>
Well, they can do it: they do it in C
<wanderer>
I find it rather weird, all these ::
<asterite>
Mmm… you normally never use that "::", it's a low level unsafe operation to declare an uninitialized variable
<asterite>
To create things you use `new`
<asterite>
We chose "::" because it was free in the Ruby grammar, kind of…
<asterite>
Ruby grammar already occupies many symbols...
<asterite>
In ruby you can actually do: x = 1; x::abs
<asterite>
but we don't like that, "::" is for namespace, "." is for method call
<wanderer>
I'm used to C and when seeing crystal, all these different initialisation methods, also structs, records, staticarrays, arrays paired with compiler magic are not easy to get going with
<asterite>
Mmm… there isn't much compiler magic, really
<asterite>
In C you do: `int value;`. That is the same as `value :: Int32` in crystal, only different syntax
<asterite>
Or in C: `int value[8];`, in crystal: `value :: Int32[8]`
<wanderer>
I've read through some of the blog entries and it seems there are like 3 or 4 ways to create Closures, with compiler magic I also mean that UInt32[8] decays to StaticArray.new(UInt32, 8)
<wanderer>
*StaticArray(UInt32, 8).new
<asterite>
Ah… well, we could remove that syntax, we only added it so writing C bindings is easier and shorter
<asterite>
Otherwise: fun atoi(str : Pointer(UInt8)) : Int32
<asterite>
A bit long, but still doable
<asterite>
I think Ruby also has 3 or 4 ways to create closures, maybe more
<wanderer>
yes, it is easier, but as the documentation of course still lacks, it's not easy yet to get a hang of it
<asterite>
I know :(
<asterite>
Mmm… did you program in Ruby before?
<wanderer>
e.g. there are no docs for StaticArrays yet, so there is no real overview over all the syntactical possibilities which is why they all float through your head halfway and you can't dive into crystal that well :P
<wanderer>
once some time ago, normally I use C, x86/x64 asm and javascript
<asterite>
Yes… I'm slowly adding documentation, but it's a lot of work, there are many classes and methods
<asterite>
I think it's easier to understand crystal if you know ruby (of course). About closures, I think there are only two ways in crystal: the ->{ … } syntax and captured blocks
DeBot has quit [Quit: Crystal]
DeBot has joined #crystal-lang
<wanderer>
It's a cool language that's why I'm trying to dive into it and also to contribute, it's not easy yet, though, if you aren't that familiar with Ruby
<wanderer>
I also find the syntax has many possibilies overall, but again for example `..` and `...` aren't documented yet, too, if you don't know them, using Crystal to a bigger extent is kind of hard
<asterite>
Yes, we need to document those
<asterite>
The other day I started documenting blocks, but I feel like there are lots of blogs and websites out there describing how ruby blocks work, so it feels like duplicated work
<asterite>
However, I think we should nonetheless document them from the beginning, as if you don't know them
<wanderer>
what is actually that `bc_flags`-file that gets created when compiling something? also what are `.crystal` and `.build` for?
<asterite>
In .crystal we store .bc (llvm bitcode) and .o files from previous compilations. So if an llvm module we generate didn't change from the previous run, we reuse the .o file
<asterite>
For example compiling the compiler the first time takes about 10 seconds, and the second one about 6 seconds without changes. If you introduce changes, only the affected files get recompiled
<asterite>
The bc_flags holds the llvm flags for which those '.bc' are valid. For example if you compile a program, the recompile it with some other link flags or target triple, we can't reuse the cached one (now that I think it, I'm not sure about this)
<asterite>
Finally, the .build holds the newly created compiler, so you can try it (this only applies to the compiler project)
<asterite>
when you do bin/crystal it will use .build/crystal if available, or the one installed in your machine
<wanderer>
so it's hardcoded where the intermediate files are put during compilation?
<wanderer>
when using gcc you would create a /obj/-folder yourself and make gcc emit files to that directory
<asterite>
We think it's simpler if the user doesn't have to deal with all of that
havenwood has quit []
<wanderer>
ok
<wanderer>
>> module SomeModule; class SomeType; end; def some_method; 1; end ; end; include SomeModule; some_method
<DeBot>
wanderer: 1
<wanderer>
docs say, it's the same as SomeModule.some_method
<wanderer>
>> module SomeModule; class SomeType; end; def some_method; 1; end ; end; SomeModule.some_method
<DeBot>
wanderer: Error in line 3: undefined method 'some_method' for SomeModule:Class
<asterite>
Ah, right, the docs are wrong
<wanderer>
does it need an `extends self` or how would SomeModule.some_method work?
<asterite>
Yes, it needs and `extend self` or make the method a class method
<asterite>
but SomeModule.some_method doesn't work, the doc should say "OK" but nothing else
<wanderer>
it says `some_method # OK, same as SomeModule.some_method` so I expected SomeModule.some_method to work
<asterite>
Yeah… but there's no equivalent really
<wanderer>
yeah, got that now, elsewise it would need an extend, I interpreted the snippet wrongly
havenwood has joined #crystal-lang
<wanderer>
for someone who's new to ruby's extend and include , it's kind of unclear what would work and what not
<wanderer>
especially with that comment `# OK, same as SomeModule.some_method`
<jhass>
Rubys toplevel is basically Object.new.instance_eval { top level code here }, Crystal only fakes that
<asterite>
Yes
<asterite>
There, I just changed the docs
jhass has quit [Quit: Bye]
jhass has joined #crystal-lang
shama has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
knoopx has joined #crystal-lang
Ven has joined #crystal-lang
knoopx has quit [Remote host closed the connection]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
asterite1 has joined #crystal-lang
asterite has quit [Ping timeout: 264 seconds]
wanderer has quit [Quit: Page closed]
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sferik has joined #crystal-lang
asterite1 has quit [Quit: Leaving.]
asterite has joined #crystal-lang
asterite_ has joined #crystal-lang
asterite has quit [Ping timeout: 256 seconds]
leafybasil has quit [Remote host closed the connection]
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
havenn has joined #crystal-lang
havenwood has quit [Ping timeout: 245 seconds]
sferik has joined #crystal-lang
waj1 has joined #crystal-lang
waj has quit [Ping timeout: 250 seconds]
eli-se has joined #crystal-lang
<eli-se>
hi :3
ismaelga has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
bcardiff1 has joined #crystal-lang
bcardiff has quit [Ping timeout: 250 seconds]
leafybasil has quit [Ping timeout: 246 seconds]
waj has joined #crystal-lang
ismaelga has joined #crystal-lang
waj1 has quit [Ping timeout: 252 seconds]
ponga has joined #crystal-lang
bcardiff1 has quit [Quit: Leaving.]
eli-se has quit [Quit: Leaving...]
ponga has quit [Read error: No route to host]
eli-se has joined #crystal-lang
bcardiff has joined #crystal-lang
bcardiff1 has joined #crystal-lang
bcardiff has quit [Read error: Connection reset by peer]
ponga has joined #crystal-lang
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]