Skip to content

Instantly share code, notes, and snippets.

@pdtwonotes
Created December 25, 2016 17:59
Show Gist options
  • Save pdtwonotes/5f3f6aed7005da913396713534315dfa to your computer and use it in GitHub Desktop.
Save pdtwonotes/5f3f6aed7005da913396713534315dfa to your computer and use it in GitHub Desktop.
Calling a function on an iso
class Foo
var n: USize = 0
new iso create() => None
fun iso set_n( m: USize ) =>
n = m
actor Main
var foo: Foo iso
new create( env: Env ) =>
foo = Foo()
foo.set_n(3)
This gets error
Error:
/home/pd/Develop/PonyLang/t/t.pony:11:14: receiver type is not a subtype of target type
foo.set_n(3)
^
Info:
/home/pd/Develop/PonyLang/t/t.pony:11:5: receiver type: Foo iso!
foo.set_n(3)
^
/home/pd/Develop/PonyLang/t/t.pony:4:3: target type: Foo iso
fun iso set_n( m: USize ) =>
^
/home/pd/Develop/PonyLang/t/t.pony:8:12: Foo iso! is not a subtype of Foo iso: iso! is not a subtype of iso
var foo: Foo iso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment