You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haxe...@googlegroups.com
Hi all,
I’ve got a method which can accept a String or Float as value. In this case I would have to use an Enum. And then I would have to specify the Type every time it’s used like:
foo.set(Float( value ))or foo.set(String( value )).
But I would prefer to write it like this:
foo.set( value );
Is there a way to write it like this and have the method detect which type it is?
Adrian
Dan Korostelev
unread,
May 8, 2015, 8:44:07 AM5/8/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haxe...@googlegroups.com
If i understand you correctly, you can achieve this using abstract casting, like this: http://try.haxe.org/#379dD
пятница, 8 мая 2015 г., 13:13:44 UTC+3 пользователь Adrian Martinez написал:
Adrian Martinez
unread,
May 8, 2015, 4:01:54 PM5/8/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haxe...@googlegroups.com
Hi Dan,
Marvellous solution! This is exactly where I was looking for. Thank you very much for the example.
Best, Adrian
Op vrijdag 8 mei 2015 14:44:07 UTC+2 schreef Dan Korostelev:
Adrian Martinez
unread,
May 9, 2015, 4:05:20 AM5/9/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haxe...@googlegroups.com
Hi Dan,
I would also like to use an Array<Value> as optional argument. So the possible use cases would be:
foo(1); foo("hello"); foo([1,“hello”]);
Is this also possible inside this context? I tried implementing it in your example but I couldn’t make it work.
Best, Adrian
Op vrijdag 8 mei 2015 14:44:07 UTC+2 schreef Dan Korostelev:
If i understand you correctly, you can achieve this using abstract casting, like this: http://try.haxe.org/#379dD
Mathieu Emilian
unread,
May 9, 2015, 7:33:28 AM5/9/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message