Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MMD function __add not found

4 views
Skip to first unread message

Francois Perrad

unread,
Oct 27, 2006, 4:11:11 AM10/27/06
to perl6-i...@perl.org

In PIR language, I create a new class 'thread' by subclassing
'Parrot::Coroutine'.
And I want write a method '__add' for support the opcode 'add'.
But, I can't found the correct syntax.
Is it possible to mix :method and :multi ?


# languages/lua/lib/thread.pir extract
.namespace [ 'Lua' ]
.sub 'init_thread' :load :anon
load_bytecode 'Parrot/Coroutine.pbc'
$P0 = subclass 'Parrot::Coroutine', 'thread'
.end

.namespace ['thread']
.sub __add :multi(thread, pmc)
.param pmc self
.param pmc right
.param pmc dest
print "add ok\n"
.return (dest)
.end

# test
.namespace [ 'Lua' ]
.HLL 'Lua', 'lua_group'

.sub '__start' :main
load_bytecode 'thread.pir'
_main()
.end
.sub '_main'
.const .Sub F1 = "f1"
find_type $I0, "thread"
$P1 = new $I0, F1
$P2 = new $I0, F1
$P0 = add $P1, $P2
end
.end
.sub 'f1'
print "f1()\n"
end
.end

I obtain the following error :
MMD function __add not found for types (86, 86)
current instr.: 'lua;Lua;_main' pc 28 (test_add.pir:13)

François.

thread.pir
test_add.pir
0 new messages