xt),
Hash(fromkeys), Iterator(next), and PerlHash(fromkeys) now?
- Sam Ruby
t(interp, entry) {
const MMD_init _temp_mmd_init[] = {...};
Parrot_mmd_register(interp, entry, _temp_mmd_init, N_MMD_INIT);
}
followed later by the following calls:
Parrot_scalar_mdd_init(interp, entry);
Parrot_Integer_mmd_init(interp, entry);
Parrot_PerlInt_mmd_init(interp, entry);
- Sam Ruby
Leopold Toetsch wrote:
Sam Ruby <[EMAIL PROTECTED]> wrote:
I continue to disagree with the part of this conclusion where you insert
find_method into the discussion. To give a concrete example: at the
moment the lookup involved in abs_p_p does not involve the use of
find_method.
$ cat abs.im
Eirik Berg Hanssen wrote:
Leopold Toetsch <[EMAIL PROTECTED]> writes:
Sam Ruby <[EMAIL PROTECTED]> wrote:
I took a look into this. Apparently, in Perl5, the result of xor'ing
undef with anything is undef. I'm not suggesting that this is either
right or wrong (it actuall
*.t
t/dynclass/pybuiltinok
t/dynclass/pyclass..ok
t/dynclass/pyfunc...ok
t/dynclass/pyintok
All tests successful.
Files=4, Tests=37, 8 wallclock secs ( 7.59 cusr + 0.62 csys = 8.21 CPU)
- Sam Ruby
s of each of the
paramters) at runtime. At the moment, I'm storing this as a property.
- Sam Ruby
p
This would enable JITs to convert the above new opcode into the
equivalent "new Px, Ic" variety in many cases.
3) The pybuiltin.__load__() function is automatically called by the
library _init loading hook now.
There is one more test in t/dynclases/pybuiltins that has an example.
Cool, thanks!
- Sam Ruby
ed after
that point, and still retains this new value when control returns to
Parrot_get_repr_s_p.
- Sam Ruby
Leopold Toetsch wrote:
Sam Ruby wrote:
However, VTABLE_invoke on NCI methods is where the "real work" is done
(including reading from and writing to registers), and a null dest is
returned.
One more remark:
This is classes/nci.pmc:invoke
void* invoke (void * next) {
Par
polymorphic inline cache. Once it is ready and tested, we can explore
setting things up so that the various mmd_dispatch_* functions to
exploit this functionality for the existing predefined binary operations.
- Sam Ruby
Leopold Toetsch wrote:
Sam Ruby wrote:
Leopold Toetsch wrote:
The caller sets:
mmd_flag := NULL ... no MMD, plain method lookup
mmd_flag := &depth ... return the next matching method starting
at the given parent search depth
In the general case, how does
re a call to pmc_new on each
method call on an instance, as well as reinserting the argument as the
first parameter (shifting each of the curent parameters in the process).
Blech.
- Sam Ruby
Leopold Toetsch wrote:
Sam Ruby wrote:
Leopold Toetsch wrote:
However, from <http://www.perl.com/pub/a/2004/04/16/a12.html?page=10>:
Whenever you make a call using subroutine call syntax, it's a
candidate for multiple dispatch.
I read this to mean that the *caller* does
Leopold Toetsch wrote:
Sam Ruby <[EMAIL PROTECTED]> wrote:
--- nci.pmc7 May 2004 10:33:26 - 1.27
+++ nci.pmc20 Dec 2004 22:27:11 - 1.28
+=item C
+
+Return attribute named C.
+
+=cut
+
+*/
+
+PMC* get_attr_str(STRING* idx) {
+return VTABLE_g
Leopold Toetsch wrote:
Sam Ruby wrote:
Leopold Toetsch wrote:
A few things to note: "foo" is a PMC. It therefore is an object. It
can have state (properties, attributes, etc). It can "know" how many
arguments are involved in multiple dispatch.
The MMD information can
Leopold Toetsch wrote:
Sam Ruby wrote:
Leopold Toetsch wrote:
What is the rational for this pythonism in Parrot core?
+The line of code in test case t/pie/b3 that motivates this is:
+
+ print "using", cmp.__name__
+
+Where cmp may be a NCI subroutine.
Python's builtin "cmp&qu
Leopold Toetsch wrote:
Sam Ruby wrote:
Leopold Toetsch wrote:
A "foo" PMC could represent an entire row in a two dimensional MMD, or
an entire plane in a three dimensional MMD, ... etc.
What does it mean: "represent a row..."? What about the namespace
pollution? Ag
Leopold Toetsch wrote:
Sam Ruby wrote:
First, a direct quote from
<http://www.perl.com/pub/a/2004/04/16/a12.html?page=10>:
Please let's stay at the basics. Please describe your counter proposal
for a very elementary
add Px, Py, Pz
operation.
There's really no need to procede
Leopold Toetsch wrote:
Sam Ruby wrote:
First, a few things to note: the semantics of "add" vary from language
to language. In particular, add is not guaranteed to be commutative
in Python (think string addition).
Yes, of course.
It seems obvious, but it leads to surprises. Example:
quot; come out.
It looks like this mailing list will not be suitable for civilized
discussion until Dan gets back.
Meanwhile, all existing Python tests pass:
http://www.intertwingly.net/blog/2004/12/25/Python-on-Parrot-test-status
Merry Christmas.
- Sam Ruby
about that... I've committed what I hope to be a fix.
- Sam Ruby
"make", but not by "make test" (which is at least smart enough to build
the parrot executable).
I've made a fix.
While I obviously have authority to update cvs, as near as I can tell,
my user id is not defined to the parrot bug tracking system.
- Sam Ruby
ef PMC to
be distinct, it's going to make tasks like comparing arrays with
large numbers of undefined elements much fiddlier than it should be.
Yep. Currently there is no chance to change that.
If the desire is that two new .Undef values are to be considered equal,
then the attached patch achie
Ramblings on creating a new VTABLE_call_method "slot" to help with
implementing Python's bound vs unbound methods:
http://www.intertwingly.net/blog/2005/01/03/Bound-Methods
This is related to a previous discussion on Overloaded Operator Methods:
http://xrl.us/ekh8
- Sam Ruby
Leopold Toetsch wrote:
Sam Ruby <[EMAIL PROTECTED]> wrote:
Ramblings on creating a new VTABLE_call_method "slot" to help with
implementing Python's bound vs unbound methods:
http://www.intertwingly.net/blog/2005/01/03/Bound-Methods
1) Methods are functions, where the first pa
Leopold Toetsch wrote:
Sam Ruby <[EMAIL PROTECTED]> wrote:
Leopold Toetsch wrote:
How should the following be handled:
f = "parrot".index
The CPython code is:
1 0 LOAD_CONST 0 ('parrot')
3 LOAD_ATTR0 (index)
s for
others to use.
- Sam Ruby
Leopold Toetsch wrote:
Bernhard Schmalhofer (via RT) wrote:
I noticed the there is an interesting mix of 'interpreter' and 'INTERP'
Thanks, applied except dynclasses. I leave that part up for Sam - dunno
if he got diffs there.
Applied.
- Sam Ruby
on mechanisms.
- Sam Ruby
ound method. This involves creating an object on
the heap, garbage collection, and a minor addition to the number of
instructions executed on invoke (including a nested C stack).
This could all be avoided if there was a VTABLE_callmethod interface as
the code would "know" that the intent w
Dan Sugalski wrote:
At 5:04 PM -0500 1/18/05, Sam Ruby wrote:
Dan Sugalski wrote:
Hi folks.
Welcome back!
Parrot's got the interesting, and somewhat unfortunate, requirement
of having to allow all subroutines behave as methods and all methods
behave as subroutines. (This is a perl 5 thing
Luke Palmer wrote:
Sam Ruby writes:
Mmm, syntax! :) Luckily it makes no difference to us at the parrot
level. What that should translate to is something like:
$P0 = find_method Parrot_string, "find"
# Elided check for failed lookup and fallback to attribute fetch
$P1 = make_bo
Sam Ruby wrote:
Now, what should the code for function f look like? The only
reasonable answer is something along the lines of:
getattribute $P0, P5, 'find'
I doubt that. All languages have different semantics, and we can't
implement them all, because they are conflicting. You
Leopold Toetsch wrote:
Dan Sugalski <[EMAIL PROTECTED]> wrote:
At 5:04 PM -0500 1/18/05, Sam Ruby wrote:
f = "Parrot".find
print f("r")
Note that I referenced the method as an attribute, and then called
it as a function.
Mmm, syntax! :) Luckily it makes no diff
Leopold Toetsch wrote:
Sam Ruby <[EMAIL PROTECTED]> wrote:
Leopold Toetsch wrote:
2) by a distinct Bound_Meth PMC class derived from 1)
The latter is probably cleaner. Binding the object to the callable could
be done e.g. by the C vtable.
That's exactly how PyBoundMeth works today.
Leopold Toetsch wrote:
Sam Ruby <[EMAIL PROTECTED]> wrote:
Leopold Toetsch wrote:
WRT functionality: for a call it has to shift up PMC arguments and
insert the object as P5, right?
At the moment, it contains this logic. My plans are to remove the
shifting and set the object into P2 /
[EMAIL PROTECTED] wrote:
+else if (p->vtable->base_type == enum_class_NCI) {
It was requested[1] that I not add any Python specific methods to the
NCI method... accordingly, the majority of Python methods are morphed to
a PyNCI class which subclasses the base NCI class.
- Sam R
Leopold Toetsch wrote:
Sam Ruby <[EMAIL PROTECTED]> wrote:
Leopold Toetsch wrote:
... But that doesn't
work fur user methods, especially if there is no indication that a user
function is used as a method in the first place.
def find(s, sub):
...
In Python, this is statically d
Leopold Toetsch wrote:
Sam Ruby <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote:
+else if (p->vtable->base_type == enum_class_NCI) {
It was requested[1] that I not add any Python specific methods to the
NCI method... accordingly, the majority of Python methods are morphe
Leopold Toetsch wrote:
Sam Ruby <[EMAIL PROTECTED]> wrote:
The common cases I want to optimize for are common functions being
called as common functions. And common methods being called as methods.
Yep, that's very reasonable.
The easiest way to optimize for the common methods bein
exactly which methods are to be mmd universally for all
languages and all objects.
- Sam Ruby
stuff" is in the parrot repo already.
What is left - a simple translator - can and should, IMHO, be recoded
into Perl6 once enough of that is running.
- Sam Ruby
[I hope you don't mind me putting this back on the list - I would prefer
that everybody who is interested can follow along and/or participate]
Kevin Tew wrote:
Sam Ruby wrote:
Kevin Tew wrote:
Sam,
Just wondering what the status is on python/parrot/pirate/pyrate.
These both look outdated.
Michal wrote:
On Sat, 16 Apr 2005, Sam Ruby wrote:
[I hope you don't mind me putting this back on the list - I would
prefer that everybody who is interested can follow along and/or
participate]
Kevin Tew wrote:
Sam Ruby wrote:
Hey guys,
I didn't see this until just now.
Kevin Tew
lide 36: morphing was cheap and efficient
in practice.
My research prior to the presentation was to check to see if morphing
was still in the VTable, and it is.
For now, I'll probably limit the amount of time I devote to Parrot as
there are plenty of other places where I feel more welcome.
- Sam Ruby
s actually implemented - while that does change over time, running
code has a tendency to change more slowly than the advice you may receive.
> Kevin Tew
> ___
> pirate mailing list
> [EMAIL PROTECTED]
> http://cornerhost.com/mailman/listinfo/pirate
- Sam Ruby
nally passed without a self argument. Then I was told
that that was all wrong, so I changed it (both the test and the code).
Now Kevin is being told that passing self is all wrong.
Reverting that particular change is not all that difficult. And it can
be done without gutting.
- Sam Ruby
x27;func_defaults', %s" % (ref, defaults))
and search for func_defaults in pyfunc.pmc, pyboundcall.pmc, and
pybuiltin.pmc.
Finally, take a look at the third test in
parrot/languages/python/t/basic/func.t
- Sam Ruby
How will Perl6 evaluate defaults?
Like Python:
global x
x=1
def f(p1=x):
return p1
x=2
print f()
or like Ruby:
$x=1
def f(p1=$x)
return p1
end
$x=2
puts f()
- Sam Ruby
P.S. The former prints "1", the latter, "2".
mmq
The commit message for December 17, 2004:
> r7312 | rubys | 2004-12-17 22:51:48 -0500 (Fri, 17 Dec 2004) | 2 lines
>
> Pass 'self' as the first argument on method calls
- Sam Ruby
Leopold Toetsch wrote:
>
> On Aug 23, 2005, at 22:48, Sam Ruby wrote:
>
>>> From December 16, 2004:
>>
>> http://tinyurl.com/8smmq
>
> Sounds like a really ugly misunderstanding, the more that I've proposed
> not to pass the object (P2 in old parlan
Chip Salzenberg wrote:
> On Tue, Aug 23, 2005 at 07:15:41PM -0400, Sam Ruby wrote:
>
>>Leopold Toetsch wrote:
>>
>>>I've stated several times that calling conventions need changes to
>>>properly support HLLs with minor success at these times.
>>
Leopold Toetsch wrote:
> Sam Ruby wrote:
>
>> Let me try again to move the discussion from subjective adjectives to
>> objective code. Consider:
>
> [ example code ]
>
>> If you run this, you will get 1,2,3.
>>
>> When called as a function, f wil
Leopold Toetsch wrote:
> Sam Ruby wrote:
>
>> Leopold Toetsch wrote:
>
>>> A stripped down PIR-only, pythonless translation is below.
>
>> (example: classes aren't global in Python),
>
> Yes, of course. The stripped down means essential the absenc
e, there is a find_method VTABLE entry, and the implementation
of this function calls __get__ which performs the curry function, per
the Python specifications.
Does Parrot_find_method_with_cache cache the results of the previous
call to find_method?
- Sam Ruby
emitted by
Pirate are @anon.
Modules are namespaces and can contain classes, functions, and
variables. The way to retrieve a method from a Python class defined in
module __main__ would be:
$P1 = findglobal "__main__", "Foo"
getattribute $P2, $P1, 'g'
- Sam Ruby
101 - 156 of 156 matches
Mail list logo