These are chat archives for opal/opal

16th
Mar 2016
Elia Schito
@elia
Mar 16 2016 09:33
@fkchang @wied03 I'm in too, just wanted to do the same, and also add some jsx like capabilities via compiler hacks, in that sense I think passing children directly as an array should be allowed (vs. using block) to make it super performant
CJ Lazell
@cj
Mar 16 2016 18:40
Afternoon. If I wanted opal to not compile code between module ServerMethods; end, what would be the best way to go about it?
without having to add if RUBY_ENGINE != 'opal'
Elia Schito
@elia
Mar 16 2016 18:42
That's the official way, other ways aren't guaranteed to work
CJ Lazell
@cj
Mar 16 2016 18:43
I know that's the offical way, I just want to make the code cleaner as it seems redundant having to do if RUBY_ENGINE != 'opal'; module ServerMethods
I wanted to avoid extra nesting by making it so any thing between module ServerMethods was just not compiled as it is intendend for server methods only
it would just make the syntax a lot cleaner
Ilya Bylich
@iliabylich
Mar 16 2016 18:55
You can try to extract server code to a separate file and wrap requiring with if opal engine = ...
You can even split the logic into multiple files by reopening a class/module again and again
Elia Schito
@elia
Mar 16 2016 19:20
Sorry, was in a hurry, my advice is to put the if/unless at the final "end" on the module
CJ Lazell
@cj
Mar 16 2016 20:27
@elia no problem. I guess I'll just have to do that for now
CJ Lazell
@cj
Mar 16 2016 20:52
I just tried using opal-compiler.js (0.9.2) and it's throwing Opal.normalize_loadable_path is not a function errors
CJ Lazell
@cj
Mar 16 2016 20:58
@elia I know we talked about this before breifly, but normalize_loadable_path looks like it's still used in the code a lot
opal/opal#1400