liberty-eiffel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Infix "*" in ABSTRACT_STRING


From: Patrick Cloarec
Subject: Re: Infix "*" in ABSTRACT_STRING
Date: Fri, 29 Dec 2023 15:25:39 +0100
User-agent: Mozilla Thunderbird

HI,

I wouldn't use an infix operator for that purpose : it wouldn't be commutative (we can't add  infix "*" (n: STRING) to class INTEGER), and "*" is already used as commutative operator, that is, INTEGER x INTEGER-> INTEGER , whereas the proposal would add it a new binary function : STRING x INTEGER -> STRING.

Such a functionality is perfectly acceptable as regular FUNCTION (e.g. a feature named "repeat" in class ABSTRACT_STRING). infix operators are embarrassing aspects of Eiffel.

Patrick

Le 28/12/2023 à 21:20, Raphael Mack a écrit :
Am Donnerstag, dem 28.12.2023 um 07:45 +0100 schrieb Paolo Redaelli:
Is there a particolar reason why we do not have an infix "*" (n:
INTEGER) query in ABSTRACT_STRING to allow code like

"Ho "*3+"! Merry Christmas" ~ "Ho Ho Ho! Merry Christmas" 
Mh, Wouldn't that give us "Ho Ho Ho ! Merry Christmas" - I. e. with the
usual "additional space at the end"-problem?

Jokes apart, I guess it is there since a very long time and I would
vote for keeping it to keep backward compatibility, as long as none has
issues with it. - I guess you checked ECMA and ISE and both don't have
this "beautiful" feature, right?

Regards,
Rapha


reply via email to

[Prev in Thread] Current Thread [Next in Thread]