Apparently, there isn't a whole lot of syntax checking going on in certain classes :)
In src\fwt\TextWidget.fan:
**
** False for text fields and true for multiline text areas.
** Default is false for `Text` widgets and true for `RichText`
** widgets. This field cannot be changed once the widget
** is constructed.
**
const Bool multiLine := this is RichText
KevinKelleySun 14 Mar 2010
const Bool multiLine := this is RichText
That's actually good code, imo anyway... is corresponds to as, doing what you'd expect: returns true if this is an instanceof RichText.
Oh wow... it is, isn't it? I even considered that possibility in my head, but then passed it off.
jodastephenThu 18 Mar 2010
If you'd seen
const Bool multiLine := this isa RichText
would that have been clearer?
"is a" becoming isa might be a helpful change?
tacticsThu 18 Mar 2010
would that have been clearer?
I don't think so. It's just very awkward to see an English sentence in the code. Not to mention it makes reference to a subclass, which isn't clean OO.
I think the more idiomatic way of expressing this would be to give it a default of false and make it virtual, allowing RichText to override it.
tactics Sun 14 Mar 2010
Here's a weird one.
In this doc, the default value for the
multiLine
slot (a boolean) isthis is RichText
.http://fantom.org/doc/fwt/TextWidget.html#multiLine
tactics Sun 14 Mar 2010
Apparently, there isn't a whole lot of syntax checking going on in certain classes :)
In
src\fwt\TextWidget.fan
:KevinKelley Sun 14 Mar 2010
That's actually good code, imo anyway...
is
corresponds toas
, doing what you'd expect: returns true ifthis
is aninstanceof
RichText.See docLang::Expressions#typeChecking
That's one of my favorite little fantomisms. :-)
tactics Sun 14 Mar 2010
Oh wow... it is, isn't it? I even considered that possibility in my head, but then passed it off.
jodastephen Thu 18 Mar 2010
If you'd seen
would that have been clearer?
"is a" becoming
isa
might be a helpful change?tactics Thu 18 Mar 2010
I don't think so. It's just very awkward to see an English sentence in the code. Not to mention it makes reference to a subclass, which isn't clean OO.
I think the more idiomatic way of expressing this would be to give it a default of
false
and make it virtual, allowingRichText
to override it.