> On Jul 20, 7:38 pm, Akshaal <l...@toril.ru> wrote:
>> Termware is a very good framework for high level computations. But
>> there is a room to grow. Is there ongoing work to remove
>> System.out.println from the sources and add a support for long number
>> values?
>>
> 1. We have no System.out.println in sources, instead we pass to
> system callback interface IEnv,
> which incapsulate all output.
> I.e. to handle output by own methods, you must
> a) create class IEnv whith own implementation of getOutput(),
> getLog() and show()
> b) pass own env to system with help of TermSystem.setEnv method
> i.e. code will look like
> IEnv myEnv = new MyEnv();
> termSystem.setEnv(myEnv);
Sorry, it were not System.out.println, but System.err.println, like
System.err.println("Number format exception:"+ex.toString());
in TermWare1.jj
It would be nice to have such lines migrated to use IEnv for exception
handling (not just printing of error message, but handling as well, so one
could stop parsing).
>> For example,
>>
>> TermSystem termSystem =
>> new TermSystem (new FirstTopStrategy (),
>> new DefaultFacts (),
>> TermWare.createNewInstance ());
>>
>> termSystem.addRule ("A -> B [test(1216568340864)]");
>>
>> will get you exception (see below) on the screen only and behavior as
>> if you have given it ""A -> B [test(0)]"".
>>
>> Number format exception:java.lang.NumberFormatException: For input
>> string: "1216568340864"
> About handling big numbers in text -- goog idea.
> for now we support big integers internally, i.e.
> Term term = termFactory.createBigInteger(bi);
> will work.
> I think in shortcoming release we will propose some syntax for
> handling big integers in strings.
I suppose 1216568340864L (pay attention to L suffix) is natural enough for
Long value.
--
... WBR, Evgeny Chukreev ...