Macro question.

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Macro question.

laurence taylor
Is it possible to create an interface method in :build or :autoBuild? The typedef for Function necessitates an expression, and will not compile with null, but a method body throws an error. Is there a way I haven't found, or is it a planned feature, or neither? 
If neither, I'd point out that Traits are most likely do-able as they flatten out to the class hierarchy, but I think it's necessary to allow a hierarchy of traits (interfaces with references to supplied methods) whose methods use methods higher up the chain, which would need that functionality.
regards,
loz

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Macro question.

Jordo Odroj
I've been seeking a way to make nulls absolutely impossible with Haxe,
but unfortunately the dominant sentiment unfortunately seems to be
that most don't see this as valuable and/or worth handling the edge
cases. Not to seem as if it is an easy problem to solve in the face of
integrating with other platforms. Let me be clear - it is going to be
tough, and I'll keep working on this problem for the next few months
until I can arrive at a reasonable solution.

But in your case, is it that you want an abstract class? One that
requires that children implement certain missing methods that are part
of the parent's interface?

On Sat, Apr 9, 2011 at 2:04 PM, laurence taylor <[hidden email]> wrote:

> Is it possible to create an interface method in :build or :autoBuild? The
> typedef for Function necessitates an expression, and will not compile with
> null, but a method body throws an error. Is there a way I haven't found, or
> is it a planned feature, or neither?
> If neither, I'd point out that Traits are most likely do-able as they
> flatten out to the class hierarchy, but I think it's necessary to allow a
> hierarchy of traits (interfaces with references to supplied methods) whose
> methods use methods higher up the chain, which would need that
> functionality.
> regards,
> loz
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Macro question.

laurence taylor
Wait, I've been thinking about it, and I don't think Traits actually needs this, but something else I'm doing does, but anyway. Returning method signatures, how does it work?  
Something about Traits:

" A Trait differs from an abstract type in that it provides implementations of its methods, not just type signatures."

I'm not sure where I sit on the multitypes, nullable values debate. I've started looking at the compiler, but I'm still a long way off implementing anything in it.



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Macro question.

Nicolas Cannasse
In reply to this post by laurence taylor
Le 09/04/2011 23:04, laurence taylor a écrit :
> Is it possible to create an interface method in :build or :autoBuild?
> The typedef for Function necessitates an expression, and will not
> compile with null, but a method body throws an error. Is there a way I
> haven't found, or is it a planned feature, or neither?

Try to return the empty block  EBlock([])

Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Macro question.

laurence taylor
woops, my bad, sorry.

On Sun, Apr 10, 2011 at 11:30 AM, Nicolas Cannasse <[hidden email]> wrote:
Le 09/04/2011 23:04, laurence taylor a écrit :

Is it possible to create an interface method in :build or :autoBuild?
The typedef for Function necessitates an expression, and will not
compile with null, but a method body throws an error. Is there a way I
haven't found, or is it a planned feature, or neither?

Try to return the empty block  EBlock([])

Nicolas

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Macro question.

Jordo Odroj
By the way, there is a *really* handy parse() method that lets you
write text that is parsed into expressions for returning exactly the
code you want!
;)



On Sun, Apr 10, 2011 at 3:25 AM, laurence taylor <[hidden email]> wrote:

> woops, my bad, sorry.
> On Sun, Apr 10, 2011 at 11:30 AM, Nicolas Cannasse
> <[hidden email]> wrote:
>>
>> Le 09/04/2011 23:04, laurence taylor a écrit :
>>>
>>> Is it possible to create an interface method in :build or :autoBuild?
>>> The typedef for Function necessitates an expression, and will not
>>> compile with null, but a method body throws an error. Is there a way I
>>> haven't found, or is it a planned feature, or neither?
>>
>> Try to return the empty block  EBlock([])
>>
>> Nicolas
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org