Wiki update
Bill Frantz <[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Message-ID | <r314ps-1066i-598E5E2FA3D84BC0A4D77EE612514F11@Bill-Frantzs-MacBook-Pro.local> |
In support of my own sanity, I added a bit at the end of
<http://wiki.erights.org/wiki/Walnut/Ordinary_Programming/Interfacing_to_Java#Speaking_to_Java_objects_with_superclass.2Fsubclass_overloaded_methods>
as follows:
Accessing functions in the java.lang.Math class are a
particularly interesting case. Some of these functions are
overloaded on float, double and perhaps int and long. While E
does not support float and has a different view of integers, it
still sees these functions as overloaded. Accessing the correct
function is simple,if verbose:
<pre>
def Math := <unsafe:java.lang.makeMath>
def abs(value) {
return E.call(Math, "abs(double)", [value])
}
--------------------------------
Note that abs() is probably a bad example. Coding abs directly
in E would give you an abs which works with any value that
supports " value < 0" and "- value".
However the pattern should work for other overloaded functions.
Cheers - Bill
-------------------------------------------------------------------------
Bill Frantz | The first thing you need when | Periwinkle
(408)356-8506 | using a perimeter defense is a | 16345
Englewood Ave
www.pwpconsult.com | perimeter. | Los Gatos,
CA 95032