<ozra>
Is there any way of "opening" enums (including the symbols in the namespace), or preferably: get the enum namespacing infered only in params where the type is specifically given in the declaration?
blue_deref has quit [Ping timeout: 250 seconds]
NeverDie_ has joined #crystal-lang
NeverDie has quit [Read error: Connection reset by peer]
ponga has joined #crystal-lang
ozra has quit [Ping timeout: 246 seconds]
Guest83433 is now known as orliesaurus
havenwood has joined #crystal-lang
unshadow_ has joined #crystal-lang
unshadow has quit [Ping timeout: 248 seconds]
strcmp1 has quit [Quit: Leaving]
havenwood has quit [Read error: Connection reset by peer]
havenwood has joined #crystal-lang
NeverDie_ has quit [Quit: I'm off to sleep. ZZZzzz…]
blue_deref has joined #crystal-lang
BlaXpirit has joined #crystal-lang
havenwood has quit [Ping timeout: 246 seconds]
<crystal-gh>
[crystal] asterite pushed 3 new commits to master: http://git.io/vqHUD
<crystal-gh>
crystal/master b447927 Ary Borenszweig: Small cleanup: remove unused reference to non-existing instance var
<crystal-gh>
crystal/master 61a4bc9 Ary Borenszweig: Codegen: store full context in exception handler, instead of just the vars
<crystal-gh>
crystal/master 428ba66 Ary Borenszweig: Fixed #960: allow refering to a lib type
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: http://git.io/vqHIV
<crystal-gh>
crystal/master 1f84701 Ary Borenszweig: Fixed #951: set the type of %w(...) and %i(...) arrays
<Guest95291>
I would like to ask questions on crystal. When it compiles to native code. does that produce a new binary? if yes does crystal go into a diffrent toolchain (gcc,clang). incase i want to cross compile.
<jhass>
Guest95291: yes, it does. Crystal uses LLVM to produce object files and then just invokes cc to call the linker
<crystal-gh>
[crystal] asterite closed pull request #952: Use %i %w to determine the expected type of the array literal (master...empty-array-literals) http://git.io/vqwEu
<jhass>
crystal build --help should list you some options for cross compiling and passing flags to the linker
<Guest95291>
thank you. thats all. i cant wait to try somethink easyer than c. tho that reminds me. does crystall have Pinvoke
<jhass>
what does that do?
<Guest95291>
pinvoke like FFI Exacute(Navitelibname,entrypoint,args*)
<jhass>
ah
<Guest95291>
in other words could exacute SDL_Init from libSDL
<jhass>
yes and no
<Guest95291>
? in what way
<jhass>
yes, Crystal does allow you to do that, no, it's not a runtime mechanic
<jhass>
instead the definitions are parsed at compile time and linked at compile time
<Guest95291>
is there an API that explains useing a navite lib?
<Guest95291>
i might end up writeing my own wrapper to libmono (Why people want this i have no clue. C# is nice. but i would not use for every think)
<jhass>
mh, what you'd want to use in Crystal from libmono?
<Guest95291>
not much. but i could use libmono to call into .netlibs Essentally Crytal->libmono->System.Windows.Forms. (Or i could just use QT and skip the middle man)
<jhass>
:P
<jhass>
I did play a bit with binding generation from gobject introspection
ozra has joined #crystal-lang
<jhass>
so if .netlibs provides a similar level of introspection, it could be interesting for generating a direct binding
<Guest95291>
only problem is .netlibs are interperted code
<Guest95291>
so a direct link would be diffacult
blue_deref has quit [Quit: bbn]
Guest95291 has quit [Quit: Page closed]
unshadow has joined #crystal-lang
unshadow_ has quit [Ping timeout: 256 seconds]
<ozra>
Is it possible somehow to make enum symbols local to the namespace you're in?
<ozra>
Or do you have to use consts?
<BlaXpirit>
ozra, consts, pretty sure
<ozra>
right
<jhass>
"enum symbols"? You mean :foo ?
<BlaXpirit>
ozra, there is an `enum` construct in Crystal...
<BlaXpirit>
woops,
<BlaXpirit>
jhass, there is an `enum` construct in Crystal...
<jhass>
I know
<jhass>
but I'd call those just enums
<jhass>
and there's Symbol's, so I'm wondering what's meant
<BlaXpirit>
right...
<BlaXpirit>
what's meant is enum members probably
<jhass>
mh, even then I don't fully understand the question tbh
<BlaXpirit>
jhass, i understand it like... can enum members be accessed without enum name before them
<BlaXpirit>
if enum A has member B, can u make it so it's possible to use B instead of A::B
<jhass>
mh, yeah that's one interpretation I have
<jhass>
the other being, can I use the current namespace as an enum too
<BlaXpirit>
and when we talk about consts, what's meant is writing B = A::B after the enum declaration
<jhass>
module Foo; FOO; BAR; BAZ; def foo...
<BlaXpirit>
so is there an alternative?
<jhass>
no, I'm just saying where the question is ambiguous for me
<jhass>
there are some thoughts on auto converting symbols to enums where appropriate
<ozra>
I'd love that auto conversion. Or even better - matching enum by "reverse inference" so to speak. But that would require the compiler to postpone the identification of unknown constants until/after the type inference phase, which would complicate things. But it would be neeeato :)
<ozra>
Funny there's an alias being made to BlaXpirit BlaXpirit CSFML::Keycode, polluting the namespace, and then still not making use of it in the huge list below..
<ozra>
Eh, BlaXpirit, the name just popped in, alt+tab problem :-/
<BlaXpirit>
generated code is funny :p
<ozra>
BlaXpirit: Is there a .c or .h -> .cr transpiler?
<BlaXpirit>
a couple
<BlaXpirit>
this is a custom one, not usable in the general case
<ozra>
BlaXpirit: Alright, cool, didn't know, was thinking about taking on something like that, but then I can skip that hideous task :)
<BlaXpirit>
actually, ozra, there is no c -> cr compiler
<BlaXpirit>
just things that produce lib definitions based on headers
<BlaXpirit>
a full compiler is an unsurmountable task, if even possible
<ozra>
BlaXpirit: That could pose a heavy task. But using Rose and writing a crystal backend would probably be most suitable. Don't know much about the clang AST though. Still hideous task.
<BlaXpirit>
ozra, first of all, there is no goto
<BlaXpirit>
just one of many things that crystal doessn't have from C
<ozra>
BlaXpirit: Tell me if you port som GUI for SFML, then I could possibly port my Qt app :)
<BlaXpirit>
no such plans
<ozra>
BlaXpirit: Most things can probably be "emulated", but goto - well if that's in the code, it should be considered for rewrite before in any event ;-)
NeverDie has joined #crystal-lang
Ven has joined #crystal-lang
havenwood has joined #crystal-lang
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
unshadow_ has joined #crystal-lang
txdv has joined #crystal-lang
unshadow has quit [Ping timeout: 255 seconds]
<txdv>
is there a way to tell crystal to just use .rb files instead of .cr files?
<jhass>
while Crystal doesn't care about the file extension, it is not a Ruby interpreter (or compiler), it's its own language
<txdv>
im fully aware of that
<jhass>
or are you talking about require? it looks like it needs the .cr extension, though it probably should fallback to not adding it
<jhass>
it's a macro, so you have to access the macro parameter with {{name}}
<jhass>
this version calls the method name which generates a method through the method_missing macro like def name; name; end;
<txdv>
o i get it
<txdv>
how do i create symbols from strings in crystal?
<jhass>
you can't really (except in macros)
<jhass>
the Symbol table is generated at compile time and embedded into the binary
ponga has quit [Quit: Connection closed for inactivity]
<txdv>
why is {{name}} in the method_missing not a symbol but a string then?
<jhass>
it's compile time, it makes no real difference
<jhass>
unlike Ruby, Crystal doesn't use Symbols internally to represent stuff and even if it did, those Symbol's ids wouldn't match the ones ending up in your binary
<jhass>
oh and I just realized, as you've seen you can't dynamically create symbols at runtime
<jhass>
and the compiler is a crystal program and the macros are interpreted by it
<txdv>
have you written anything with crystal?
<jhass>
DeBot here is written in Crystal
<jhass>
the backend of carc.in is written in Crystal
<jhass>
and I toyed a bit with gobject introspection
<jhass>
oh and I've written the 2048 sample ;)
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
NeverDie has joined #crystal-lang
havenwood has quit [Ping timeout: 255 seconds]
fowlduck has joined #crystal-lang
fowlduck has quit [Remote host closed the connection]
fowlduck has joined #crystal-lang
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
NeverDie has joined #crystal-lang
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: http://git.io/vqde5
<crystal-gh>
crystal/master 65264b8 Ary Borenszweig: Codegen: don't store rescue block in exception handler