You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from Standard.Base import all
type My_Warning
Value msg
to_display_text self -> Text = "My_Warning to_display_text: "+self.msg
to_text self -> Text = "My_Warning to_text: "+self.msg
pretty self -> Text = "My_Warning pretty: "+self.msg
main =
one = Warning.attach (My_Warning.Value "ONE") 1
two = Warning.attach (My_Warning.Value "TWO") 2
[one, two]
Actual behaviour
It prints
one = 1
! Value ONE
two = 2
! Value TWO
[1, 2]
Where is the Value ONE coming from? Presumably it is Atom.java::toString.
Expected behaviour
If I override to_text and to_display_text of an atom, I think it's default toString shouldn't show up anywhere.
One of to_text or to_display_text should be used when displaying warnings attached to the values. I guess to_display_text is more appropriate, so it should probably look like this:
one = 1
! My_Warning to_display_text: ONE
two = 2
! My_Warning to_display_text: TWO
[1, 2]
The text was updated successfully, but these errors were encountered:
If I override to_text and to_display_text of an atom, I think it's default toString shouldn't show up anywhere.
That's probably correct.
One of to_text or to_display_text should be used when displaying warnings attached to the values.
"One of ... should be used" - looks like how little difference there is between these two methods. You rather override both and hope one of them gets used.
I guess to_display_text is more appropriate
If we only knew what's the intended difference between those two methods!?
The system is trying to call to_text method when computing the warning message.
Run the following script:
Actual behaviour
It prints
Where is the
Value ONE
coming from? Presumably it isAtom.java::toString
.Expected behaviour
If I override
to_text
andto_display_text
of an atom, I think it's defaulttoString
shouldn't show up anywhere.One of
to_text
orto_display_text
should be used when displaying warnings attached to the values. I guessto_display_text
is more appropriate, so it should probably look like this:The text was updated successfully, but these errors were encountered: