Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: C++ named requirements as concepts
Date: Sun, 29 Sep 2024 11:23:51 -0700
Organization: A noiseless patient Spider
Lines: 74
Message-ID: <861q122ua0.fsf@linuxsc.com>
References: <86h6a15tuv.fsf@linuxsc.com> <20240929144913.000051e4@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Sun, 29 Sep 2024 20:23:55 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="af077a0b22884ed040881afe1a29036e"; logging-data="1948985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UL3o3URzAvgNTZsP3UYD5PtsqVNLnt6E="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:QnNBijZSNhqH1Ckm0D4WMQ7g97I= sha1:TVJU+tEaevpNoj4kcnGklwlj++s=
Xref: csiph.com comp.lang.c++:120456
Michael S writes:
> On Sun, 29 Sep 2024 13:41:27 +0200
> David Brown wrote:
>
>> On 28/09/2024 17:47, Muttley@dastardlyhq.com wrote:
>>
>>> On Sat, 28 Sep 2024 17:33:46 +0200
>>> David Brown gabbled:
>>>
>>>> On 28/09/2024 11:12, Muttley@dastardlyhq.com wrote:
>>>>
>>>>> On Fri, 27 Sep 2024 18:24:11 +0200
>>>>> Not sure how that differs with value polymorphism.
>>>>
>>>> I explained that - look at my answer below for another attempt.
>>>
>>> No you didn't because like Bonita you have no idea what value
>>> polymorphism is.
>>
>> The term "polymorphism" is used in reference to /types/, not
>> /values/. I am not new to programming, and have used a large variety
>> of languages (including functional programming languages), but have
>> not heard the phrase "value polymorphism" before. So I am trying to
>> get /you/ to say what /you/ mean by it. Maybe it's just a name you
>> and a few other people use for pattern matching.
>
> May be, 'polymorphism by type of return value' is what he has in mind?
In a previous posting Muttley cited this url:
https://chrisdone.com/posts/value-polymorphism/
In a different previous posting Muttley gave this example (slightly
reformatted for line length):
def main(argv) ->
func("",["hello","cruel","world","this","is","a","test"])
: 0
;
def func(_,[]) -> "";
def func(_,[head
printnl head,",",tail : func(head[0],tail);
def func("world",[head
printnl "GOT WORLD" : func(head,tail);
It's not clear what programming language is intended here. Based on
my experience with other functional languages, it looks like this
example is (a) defined wrongly, (b) wouldn't compile because of a
type mismatch, and (c) is not polymorphic. But of course we can't
be sure without knowing more about what language is intended.
The web page does use the phrase "value polymorphism", but it's
about something else altogether. The programming language Haskell
has a facility that might be called "variable overloading". It's
like what C or C++ would be if they allowed, for example:
int poly;
double poly[10];
and later on in the program a declaration such as
double *p = poly;
would know to use the double array 'poly', because the other 'poly'
doesn't type check.
My guess is Muttley is out of his depth and doesn't really know what
he means by these different phrases. But I found it impossible to
tell because in his postings he doesn't interact in any meaningful
way.