ozra / onyx-lang

The Onyx Programming Language
Other
95 stars 5 forks source link

Crystal compatibility? #58

Closed stugol closed 8 years ago

stugol commented 8 years ago

You have said that Onyx uses Crystal's class libraries. Does that mean I can use my own Crystal includes in an Onyx program somehow?

If not, I think it's pretty important that we support that. It would make migrating to Onyx far less painful than it currently would be.

require 'existing-library.cr'
require 'something-new.onyx'

I'd like to start using Onyx in place of Crystal, but I have a bunch of Crystal library code that I don't want to re-write.

ozra commented 8 years ago

You can use crystal modules / files at the drop of a hat.

require "existing-library" will look for:

In that order. That's all you need to do :-) Mix and match as you wish.

(This is the reason for having to compromise a little on language design in some situations - I flag AST-nodes internally where needed where separate compile logic is required, so that code from a crystal file is handled like crystal and follows the rules and limitations of crystal, in the end they are all part of the same tree and become the married final program)

ozra commented 8 years ago

Perhaps it would be good to put questions on stack overflow. Issues aren't really for questions, plus it gives Onyx a bit more exposure :-) Use #onyx-lang as tag (to disambiguate from probably thousand other things named onyx [I presume]).

stugol commented 8 years ago

Awesome!