boa icon indicating copy to clipboard operation
boa copied to clipboard

try.haxe.org js output unable to run.

Open nanjizal opened this issue 6 months ago • 13 comments

I was interested to see how well your playground worked, and as a Haxe user I pasted in some generated JS with no success. For simplicity tried a few from the 'examples' section. Pasting had to use keystrokes. https://try.haxe.org/ you can choose es5 or es6 from 'options'. Would be really interesting if you wired up your playground to allow haxe and even rust js input. no console.log ?

nanjizal avatar Aug 09 '25 13:08 nanjizal

feel free to close if this is of no interest.

nanjizal avatar Aug 09 '25 13:08 nanjizal

If it generates valid JavaScript code and it's unable to run, then we should investigate :)

From what I can tell console.log() is not enabled. You could try with the CLI which has some runtime feature enabled (including console.log())

Can you provide the code that cause the issue?

HalidOdat avatar Aug 09 '25 15:08 HalidOdat

using haxe.org/try Image

nanjizal avatar Aug 13 '25 18:08 nanjizal

you can access the repository if you have a server and want to experiment with compiling haxe for js and then inputting it to your rust lib. https://github.com/HaxeFoundation/try.haxe.org

nanjizal avatar Aug 13 '25 18:08 nanjizal

I would say haxe js is perhaps the fastest and most expressive way to create modern js code. So for anyone wanting to use your lib with a coder background for embedded JS then haxe would be a worthwhile approach if js lack of good typing is frustrating. Also reality is that haxe generated JS is likely quite a good test for your work as it is fast clean and can be used to create some really complex solutions.

nanjizal avatar Aug 13 '25 18:08 nanjizal

let me know if you want any help with haxe js.

nanjizal avatar Aug 13 '25 18:08 nanjizal

@nanjizal What do you want to run in the online playground, the haxe source code, or the generated js code you paste?

xbwwj avatar Aug 14 '25 03:08 xbwwj

you don't currently support either. But both would be ideal?

nanjizal avatar Aug 14 '25 18:08 nanjizal

If you got try haxe working I would definitely test it with my personal experiments. Generally haxe js is one of the fastest ways to code JS and fully typed so it is for users that are not interested in the crowd but in results it can be useful? You would likely get more complex test cases to fully test your solution.

nanjizal avatar Aug 14 '25 18:08 nanjizal

if you can allow it to do something like try.rust.boa that would be really interesting.

nanjizal avatar Aug 14 '25 19:08 nanjizal

@nanjizal

(disclaimer: not a maintainer of the project)

I think only the latter one (generated js) is reasonable, and browser support should be one of the core advantages of boa against quickjs.

But native haxe support is too niche a case that we don't even have a transpiler for that in Rust (in oxc or swc project). And such support seems to be missing in JS ecosystem (vite and esbuild) as well.

Why dont't you prefer easier and far more prevailing solutions like TypeScript (or ReScript)?

xbwwj avatar Aug 14 '25 22:08 xbwwj

I'm not entirely familiar with Haxe, but supporting Haxe directly sounds a little out of scope of our current project.

Agreed with the previous statement though that if there is generated JS code that does not run in Boa that is not due to unimplemented runtime features, then we should definitely address it.

nekevss avatar Aug 15 '25 01:08 nekevss

Xubai Wang - the boa-dev browser site maybe a little like the https://github.com/HaxeFoundation/try.haxe.org/blob/master/README.md The site is docker instance backend that runs the haxe compiler so users can run javascript even canvas stuff. But sure it is not really specific more the author may find it an interesting experiment which could be fed into his boa browser site perhaps.

As long term user of haxe I tried pasting the generated JS which is normally very good into the Boa browser test site and it would not run. I suspect other language that compile to js would also not be able to just paste their js into Boa currently either.

nanjizal avatar Aug 15 '25 15:08 nanjizal