I've changed the InvocationHandler in interface to return the correct Java
object when used with interface with returning values.

Example Java classes:

public interface Field<FIELD extends Enum<?>, VALUE> {
  public VALUE field(FIELD field);

public interface User extends Field<User.Fields, String> {
  public enum Fields {

  public default String firstName() {
    return field(Fields.firstName);

  public default String lastName() {
    return field(Fields.lastName);

Example Ersatz PicoLisp code:

(javaImport User)

(de user (@FirstName @LastName)
  (       # (interface "User" "field"
    (curry (@FirstName @LastName) (Field)
        ((= Field User.Fields.firstName) @FirstName)
        ((= Field User.Fields.lastName) @LastName) ) ) ) )

# Before
(.field> (user "Albert" "Wily") User.Fields.firstName)
# => $PicoLisp$Symbol (might not be useful for Java interoperability)

# After
(.field> (user "Albert" "Wily") User.Fields.firstName)
# => $String (might be useful for Java interoperability)
    (.field> (user "Albert" "Wily") User.Fields.firstName)
# => $String (still useful)

As always, the srborlongan-picolisp repository is always in sync with
Have fun!

P.S. Next plan is to refactor the heck out of my old Java code into Java 8
code, which would then make it easy to translate them to Ersatz PicoLisp,
which may eventually result in Plan Super-Omega Plus: rewrite Ersatz
PicoLisp in Java 8, then rewrite resulting Java 8 code into (Java-6
compatible) Ersatz PicoLisp; Ersatz in Ersatz, for radical
(slow-as-fossilized-carbonite-mollases) self-hosting capabilities.

P.P.S. I have no idea how to call Java 8 default methods from objects
created using Ersatz PicoLisp's interface method. Any suggestions?

Samuel Dennis R. Borlongan

Reply via email to