Scriptor / pharen

Lisp to PHP Compiler
http://pharen.org
BSD 3-Clause "New" or "Revised" License
218 stars 31 forks source link

Support for oop #1

Closed francescoagati closed 13 years ago

francescoagati commented 14 years ago

Should be nice create macro from oop ( classes, interfaces, instance creation).

Scriptor commented 14 years ago

Thanks for opening this issue.

By a macro, do you mean you would like something similar to (defclass FooBar ...) and (new FooBar)?

In that case, this wouldn't really be possible with macros since it's generating PHP code that the compiler does not currently support. OOP support in that sense would require compiler built-ins, which I may implement at some point in the future.

On the other hand, I've got a simple pure-Pharen implementation of multimethods right now that I'll push up sometime soon. If you have any suggestions, let me know!

francescoagati commented 14 years ago

you could a macro inline that permit of insert directly code php

for example:

(defmacro class name body )

Scriptor commented 14 years ago

Using inline, the above could probably work as a function instead of a macro.

I'm not really comfortable with inline, however. For example, inside a macro it would be difficult to figure out what exactly is being done. It could also encourage poor coding practices.

Implementing proper OOP support, without inline, wouldn't be difficult in itself, I just want to make sure I do it right the first time.

Scriptor commented 13 years ago

The beginnings of OOP support have been added. For more you can reference the oop documentation.