logo       

[jira] Commented: (BOO-250) overloaded functions cannot be "first class fun: msg#00088

lang.boo.devel

Subject: [jira] Commented: (BOO-250) overloaded functions cannot be "first class functions"

[ http://jira.codehaus.org/browse/BOO-250?page=comments#action_47085 ]

Doug Holton commented on BOO-250:
---------------------------------

Perhaps the compiler could create a method that dispatches to the right
overload at runtime, like below. Otherwise, the ironpython solution is to
specify the types in brackets after the method name like so, but I would have
thought that this would conflict with generics: r =
System.Random().Next[int](10,20)

def __parse(*args): //method created by compiler
l = len(args)
if l==1 and args[0] isa string:
return double.Parse(cast(string,args[0]))
elif l==2 and args[0] isa string and args[1] isa System.IFormatProvider:
return
double.Parse(cast(string,args[0]),cast(System.IFormatProvider,args[1]))
elif l==2 and args[0] isa string and args[1] isa
System.Globalization.NumberStyles:
return
double.Parse(cast(string,args[0]),cast(System.Globalization.NumberStyles,args[1]))

d = __parse //replacement for double.Parse

print d("34.3")


> overloaded functions cannot be "first class functions"
> ------------------------------------------------------
>
> Key: BOO-250
> URL: http://jira.codehaus.org/browse/BOO-250
> Project: Boo
> Type: Bug
> Components: Compiler
> Versions: 0.5
> Environment: Latest SVN.
> Reporter: Arron Washington
> Assignee: Rodrigo B. de Oliveira
> Fix For: 0.5.6

>
>
> Functions that are overloaded (such as double.Parse and string.Format) cannot
> be used as first class functions because the compiler cannot resolve to any
> one of the overloaded functions.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise