Re: No Cpow op with PMC arguments?

2004-11-09 Thread Jeff Clites
On Nov 8, 2004, at 3:08 AM, Leopold Toetsch wrote: Jeff Clites [EMAIL PROTECTED] wrote: No. The binary operations in Python are opcodes, as well as in Parrot. And both provide the snytax to override the opcode doing a method call, that's it. I guess we'll just have to disagree here. I don't see

Re: No Cpow op with PMC arguments?

2004-11-09 Thread Dan Sugalski
At 12:44 AM -0800 11/9/04, Jeff Clites wrote: And again, what about Ruby? If you believe in matching the current philosophy of the language, it won't use ops for operators (but rather, method calls), and won't do the right thing for objects with vtable/MMDs, and no corresponding methods. Yes it

Re: No Cpow op with PMC arguments?

2004-11-08 Thread Leopold Toetsch
Jeff Clites [EMAIL PROTECTED] wrote: On Nov 5, 2004, at 9:40 AM, Leopold Toetsch wrote: In Python, semantically you know that you'll end up doing a method call (or, behaving as though you had), so it's very roundabout to do a method call by using an op which you know will fall back to doing a

Re: No Cpow op with PMC arguments?

2004-11-08 Thread Jeff Clites
On Nov 8, 2004, at 12:50 AM, Leopold Toetsch wrote: Jeff Clites [EMAIL PROTECTED] wrote: On Nov 5, 2004, at 9:40 AM, Leopold Toetsch wrote: In Python, semantically you know that you'll end up doing a method call (or, behaving as though you had), so it's very roundabout to do a method call by

Re: No Cpow op with PMC arguments?

2004-11-08 Thread Leopold Toetsch
Jeff Clites [EMAIL PROTECTED] wrote: No. The binary operations in Python are opcodes, as well as in Parrot. And both provide the snytax to override the opcode doing a method call, that's it. I guess we'll just have to disagree here. I don't see any evidence of this UTSL please. The code is

Re: No Cpow op with PMC arguments?

2004-11-07 Thread Jeff Clites
On Nov 5, 2004, at 10:03 AM, Sam Ruby wrote: Jeff Clites wrote: a) As Sam says, in Python y**z is just shorthand for y.__pow__(z)--they will compile down to exactly the same thing (required for Python to behave correctly). Since __pow__ isn't special, we don't need anything to support it that

Re: No Cpow op with PMC arguments?

2004-11-07 Thread Jeff Clites
On Nov 4, 2004, at 5:24 AM, Sam Ruby wrote: [Referring to infix operators as an alternate syntax for a named method call] What's the downside of compiling this code in this way? If you are a Python programmer and all the objects that you are dealing with were created by Python code, then not

Re: No Cpow op with PMC arguments?

2004-11-05 Thread Luke Palmer
Jeff Clites writes: On Nov 4, 2004, at 8:29 PM, Brent 'Dax' Royal-Gordon wrote: This is true. But how do you define a number? Do you include floating-point? Fixed-point? Bignum? Bigrat? Complex? Surreal? Matrix? N registers don't even begin to encompass all the numbers out there.

Re: No Cpow op with PMC arguments?

2004-11-05 Thread Leopold Toetsch
Luke Palmer [EMAIL PROTECTED] wrote: The question is, though, how do compilers think of it? That is, does the compiler have the liberty, given the code: $x ** $y To emit: pow $P0, x, y Or must it use a named multimethod? Well, that's a thing compilers (or their writers ;) have

Re: No Cpow op with PMC arguments?

2004-11-05 Thread Jeff Clites
On Nov 4, 2004, at 5:24 AM, Sam Ruby wrote: From a Python or Ruby language perspective, infix operators are not fundamental operations associated with specific types, they are syntactic sugar for method calls. A the moment, I'm compiling x=y**z into: x = y.__pow__(z) There is nothing

Re: No Cpow op with PMC arguments?

2004-11-05 Thread Sam Ruby
Jeff Clites wrote: a) As Sam says, in Python y**z is just shorthand for y.__pow__(z)--they will compile down to exactly the same thing (required for Python to behave correctly). Since __pow__ isn't special, we don't need anything to support it that we wouldn't need for any other arbitrary

Re: No Cpow op with PMC arguments?

2004-11-05 Thread Jeff Clites
On Nov 4, 2004, at 10:30 PM, Brent 'Dax' Royal-Gordon wrote: On Thu, 4 Nov 2004 21:46:19 -0800, Jeff Clites [EMAIL PROTECTED] wrote: On Nov 4, 2004, at 8:29 PM, Brent 'Dax' Royal-Gordon wrote: This is true. But how do you define a number? Do you include floating-point? Fixed-point? Bignum?

Re: No Cpow op with PMC arguments?

2004-11-04 Thread Dan Sugalski
At 1:19 AM -0800 11/4/04, Jeff Clites wrote: On Nov 3, 2004, at 8:09 AM, Dan Sugalski wrote: At 11:04 AM -0500 11/3/04, Sam Ruby wrote: A single pow_p_p_p op backed by a (non-MMD) vtable entry would make it easier to support code like the following: def f(x): return x**3 print f(3), f(2.5)

Re: No Cpow op with PMC arguments?

2004-11-04 Thread Leopold Toetsch
Jeff Clites [EMAIL PROTECTED] wrote: I feel like we have op-itis and vtable-itis. I'm for sure the last one that would add an opcode or a vtable, if it's not needed. But in that case it has to be one. The PMC can be any kind of plain scalar and also *complex*. We have different operations with

Re: No Cpow op with PMC arguments?

2004-11-04 Thread Brent 'Dax' Royal-Gordon
Jeff Clites [EMAIL PROTECTED] wrote: I.e., PMCs don't inherently exponentiate--numbers do, and you can exponentiate PMCs by numberizing them, exponentiating, and creating a PMC with the result. This is true. But how do you define a number? Do you include floating-point? Fixed-point?

Re: No Cpow op with PMC arguments?

2004-11-04 Thread Jeff Clites
On Nov 4, 2004, at 8:29 PM, Brent 'Dax' Royal-Gordon wrote: Jeff Clites [EMAIL PROTECTED] wrote: I.e., PMCs don't inherently exponentiate--numbers do, and you can exponentiate PMCs by numberizing them, exponentiating, and creating a PMC with the result. This is true. But how do you define a

Re: No Cpow op with PMC arguments?

2004-11-04 Thread Brent 'Dax' Royal-Gordon
On Thu, 4 Nov 2004 21:46:19 -0800, Jeff Clites [EMAIL PROTECTED] wrote: On Nov 4, 2004, at 8:29 PM, Brent 'Dax' Royal-Gordon wrote: This is true. But how do you define a number? Do you include floating-point? Fixed-point? Bignum? Bigrat? Complex? Surreal? Matrix? N registers don't

No Cpow op with PMC arguments?

2004-11-03 Thread Sam Ruby
This omission seems odd. Was this intentional? A single pow_p_p_p op backed by a (non-MMD) vtable entry would make it easier to support code like the following: def f(x): return x**3 print f(3), f(2.5) - Sam Ruby

Re: No Cpow op with PMC arguments?

2004-11-03 Thread Dan Sugalski
At 11:04 AM -0500 11/3/04, Sam Ruby wrote: This omission seems odd. Was this intentional? Nope. A single pow_p_p_p op backed by a (non-MMD) vtable entry would make it easier to support code like the following: def f(x): return x**3 print f(3), f(2.5) Yeah, it would. I know I'm going to

Re: No Cpow op with PMC arguments?

2004-11-03 Thread Matt Fowles
Dan~ On Wed, 3 Nov 2004 11:09:49 -0500, Dan Sugalski [EMAIL PROTECTED] wrote: Yeah, it would. I know I'm going to regret asking, but... any reason *not* to make it MMD? (Though I have no idea what happens if you square a matrix) Squaring a matrix is easy (so long as it is square). A^2 == A *

Re: No Cpow op with PMC arguments?

2004-11-03 Thread Sam Ruby
Dan Sugalski wrote: At 11:04 AM -0500 11/3/04, Sam Ruby wrote: This omission seems odd. Was this intentional? Nope. A single pow_p_p_p op backed by a (non-MMD) vtable entry would make it easier to support code like the following: def f(x): return x**3 print f(3), f(2.5) Yeah, it would. I

Re: No Cpow op with PMC arguments?

2004-11-03 Thread Jerome Quelin
On 04/11/03 11:19 -0500, Matt Fowles wrote: What gets more fun is raising something (usually e) to a matrix power. Then you have to do things with the Jordan Connical form and decompose your matrix into eigenvalues and stuff. On the plus side, this also allows you to define the sin and cos

Re: No Cpow op with PMC arguments?

2004-11-03 Thread Matt Fowles
Jerome~ On Wed, 3 Nov 2004 18:33:28 +0100, Jerome Quelin [EMAIL PROTECTED] wrote: Damn, is it a new rule that perl 6 summarizer should be a maths teacher? :-) Actually, as an American I would be a lowly math teacher... ;-) Matt -- Computer Science is merely the post-Turing Decline of Formal