sys::Obj.with is apparently the only place where a function is allowed to take a This object as a parameter (as it shows in Obj.fan, line 92):
**
** This method called whenever an it-block is applied to
** an object. The default implementation calls the function
** with 'this', and then returns 'this'.
**
virtual This with(|This| f)
However, either the restrictions on using This changed, or this method was never available for override:
class Foo
{
override This with(|This| f)
{
echo("foo")
return this
}
}
Running this throws:
C:\Documents and Settings\Michael\Desktop>fan Foo.fan
C:\Documents and Settings\Michael\Desktop\Foo.fan(4,3): Parameter mismatch in override of 'sys::Obj.with' - 'with(|sys::Obj->sys::Void|)' != 'with(|sys::This->sys::Void|)'
ERROR: cannot compile script
Seems like either with needs to be changed to take an actual |Obj| param, or with needs a little more magic compiler dust.
alexlamsl Mon 4 May 2009
Bump into this while reading Obj.with
andy Mon 4 May 2009
Promoted to ticket #569 and assigned to andy
tactics Mon 8 Mar 2010
This seems to be a weirdo of an issue.
sys::Obj.with
is apparently the only place where a function is allowed to take aThis
object as a parameter (as it shows in Obj.fan, line 92):However, either the restrictions on using
This
changed, or this method was never available for override:Running this throws:
Seems like either with needs to be changed to take an actual
|Obj|
param, orwith
needs a little more magic compiler dust.brian Tue 11 May 2010
Ticket resolved in 1.0.53
This issues is fixed by #1056