liberty-eiffel
[Top][All Lists]
Advanced

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

Re: Infix "*" in ABSTRACT_STRING


From: Paolo Redaelli
Subject: Re: Infix "*" in ABSTRACT_STRING
Date: Sat, 30 Dec 2023 16:06:03 +0100
User-agent: Mozilla Thunderbird


Il 30/12/23 13:19, Eric Bezault ha scritto:
On 30/12/2023 10:36, Patrick Cloarec wrote:
It is unnatural to me to define a binary operator as the feature of the class of one object. infix is the less intuitive construction offered by Eiffel, in my humble opinion.

They are available in one way or another in many
other languages. For example, in Python:

>>> "Ho "*3+"! Merry Christmas"
'Ho Ho Ho ! Merry Christmas'

And in Python it works also inverting the integer and the string:

3*"Ho "+"! Merry Christmas" == 'Ho Ho Ho ! Merry Christmas"

true

The issue here is that having operators overloading clashes with a "clean" implementation of multiple inheritance.

So I wonder if integer/natural types and "collections" share at least conceptually a "mathematical structure" that offers repetition.




reply via email to

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