Leopold Toetsch wrote:
OTOH when you have
math.sin(2)
Python emits:
6 44 LOAD_NAME 0 (math) 47 LOAD_ATTR 1 (sin) 50 LOAD_CONST 1 (2) 53 CALL_FUNCTION 1
which actually is a method call on the "math" object. And the math object is a namespace alias of e.g. the Float PMC.
The "math" object is actually a module. Once imported, you also find it lexically. What Pirate emits for math.sin(2) follows:
find_type $I0, "PyInt" new $P0, $I0 $P0 = 2 find_lex $P2, 'math' $P1=$P2.sin($P0)
In the direction I am currently heading, nothing that Pirate emits will make any direct use of Parrot namespaces. (Yes, Parrot internally uses namespaces for NCI methds - currently). All subroutines (except main) are @ANON.
Do you find that surprising?
At the moment it is hard to argue how Parrot could/should change in order to better support a language like Python. Many of the features that exist in Parrot are based on assumptions of what language implements will want. In several cases, I disagree with those assumptions - i.e., YAGNI.
Am I right? Who can tell at this point. We'll know when we get there.
- Sam Ruby