Clint Jeffery wrote:
> [Dennis writes that he can't call built-in sin() from inside a class that
> has a sin() method.]
>
> Hi Dennis,
>
> It is true that class scope is more local than (and hides/overrides) the
> global scope.  This is a feature, not a bug.
>
> >From inside your class, though, you can obtain a reference to the built-in
> sin() function with proc("sin",0).  So, you can have your cake and eat it too.
> Look in the ipl for lots of examples of calling proc( ... , 0 ) whenever there
> is a potential name conflict.
>   
Isn't it simpler to, as in C++, simply specify ::sin() when you want to 
access the global function? I suppose
that's a package-based solution, but it seems more convenient than 
having to use proc()

class Test()
  method sin()
    return ::sin(3.14)
  end
end

procedure main()
  local t := Test()
  write("It returned " || t.sin())
end

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to