Void does not pass as Dynamic (SVN)

74 views
Skip to first unread message

Renaud Bardet

unread,
Jan 30, 2013, 9:15:10 AM1/30/13
to haxe...@googlegroups.com
Hi, I was using the svn r5794 to test h3d and trying to pass a T -> Void in place of a T -> Dynamic doesn't work, plus I can no longer type an argument as Void
is this a new feature ? is there a new wildcard that allow Void or Dynamic ?

Mihail Ivanchev

unread,
Jan 30, 2013, 9:19:30 AM1/30/13
to haxe...@googlegroups.com
This was fixed some revisions ago upon my request to mark it as a bug. Void does not really indicate a value, but an absence of value. If you wish to specify a non-value, you can always use "null". I hope that clarifies it a bit. T->Dynamic still indicates that the function should return something, while T->Void indicates that the function never returns anything. So to say, Void doesn't indicate a type. var x:Void is therefore meaningless.

Regards,
Mihail

On Wed, Jan 30, 2013 at 3:15 PM, Renaud Bardet <ren...@mandalagames.com> wrote:
Hi, I was using the svn r5794 to test h3d and trying to pass a T -> Void in place of a T -> Dynamic doesn't work, plus I can no longer type an argument as Void
is this a new feature ? is there a new wildcard that allow Void or Dynamic ?

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxelang+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Renaud Bardet

unread,
Jan 30, 2013, 9:54:31 AM1/30/13
to haxe...@googlegroups.com
it's a bit anoying because it forces to make a distinction between functions that will return something and those that won't, there is no middle choice, if I wish to take a funciton that is not required to return something because I won't treat the return, I have no option.

in a related subject, Void is not always an absence of type,
here's an extract of my custom Signal class:
class Signal<T> {
   var callbacks : List<T->Dynamic> ;
...
}

when i use it as Signal<Void>, callbacks is not a List<Void->Dynamic> but actually a List<(Void)->Dynamic>, where (Void) is in fact the type of null and not the absence of type,
this was very painfull to use so I added a voidCallbacks : List<Void->Dynamic>, but still, (Void) may be used as a type in case of a generic class

that's just food for thoughts

Simon Krajewski

unread,
Jan 30, 2013, 10:05:28 AM1/30/13
to haxe...@googlegroups.com
Am 30.01.2013 15:54, schrieb Renaud Bardet:
> it's a bit anoying because it forces to make a distinction between
> functions that will return something and those that won't, there is no
> middle choice, if I wish to take a funciton that is not required to
> return something because I won't treat the return, I have no option.

You can assign a -> Any function to a -> Void function.

Simon

Renaud Bardet

unread,
Jan 30, 2013, 10:17:41 AM1/30/13
to haxe...@googlegroups.com
Ok thanks

j...@justinfront.net

unread,
Jan 30, 2013, 3:32:49 PM1/30/13
to haxe...@googlegroups.com
Did you try Void<Dynamic>

On 30 Jan 2013, at 14:15, Renaud Bardet wrote:

Hi, I was using the svn r5794 to test h3d and trying to pass a T -> Void in place of a T -> Dynamic doesn't work, plus I can no longer type an argument as Void
is this a new feature ? is there a new wildcard that allow Void or Dynamic ?

j...@justinfront.net

unread,
Jan 30, 2013, 3:59:53 PM1/30/13
to haxe...@googlegroups.com
Ok that won't work I am thinking of Null<Int> not sure Null<Dynamic> would exist but probably no use either.
Reply all
Reply to author
Forward
0 new messages