Anyone using com.redhat.ceylon.compiler.java.runtime.Main programmatically?

27 views
Skip to first unread message

Stephane Epardaud

unread,
Aug 26, 2015, 11:42:23 AM8/26/15
to ceylon-dev, ceylon...@googlegroups.com
As opposed to from a Java command?

I'm thinking of making `main` catch exceptions and exit with an error code, because the JVM makes this undefined.

This API was never meant to be called programatically, but perhaps some people do?

I'm a bit wary of introducing `System.exit` calls as we've been bitten by them quite often in the past, but I think that in a `main(String[])` method when there's an exception throw by the main thread, that's the right thing to do. It allows the process callers to know something went wrong. At least with the main thread.
--
Stéphane Épardaud

John Vasileff

unread,
Aug 26, 2015, 12:11:18 PM8/26/15
to ceylo...@googlegroups.com
Can “main” then be made to be a small wrapper around some other method that can be used programmatically? Or maybe it’s already this way.

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/CAKU9E9uUYmDERO91doFqL3_SYL_k94DO4yk8DwPvSqZr4_fpQA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Stephane Epardaud

unread,
Aug 26, 2015, 12:20:49 PM8/26/15
to ceylon-dev
I suppose I can, but there's mostly stuff about parsing the arguments, which already call `System.exit` if they're wrong. I don't see how it's useful for API users. Those will already use the API part. Preferably `CeylonToolProvider` actually. This is really only meant to be used from the command-line.


For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Stephane Epardaud

unread,
Aug 26, 2015, 12:35:26 PM8/26/15
to ceylon-dev
Ah forget it, something else was in fact catching my exception, I don't think `Main` is to blame.
--
Stéphane Épardaud

John Vasileff

unread,
Aug 26, 2015, 12:41:52 PM8/26/15
to ceylo...@googlegroups.com
I see. Makes sense. To your original question, I don’t recall how I was using Main, when I was using it.

Reply all
Reply to author
Forward
0 new messages