www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Redundancy in languages by Walter

reply Max Samukha <maxsamukha gmail.com> writes:
I was re-reading Walter's old article on redundancy and thought 
new people here might find it useful: 
https://www.digitalmars.com/articles/b05.html.

It is good overall, except for a couple of arguable points, such 
as types of temporaries condemned as bad redundancy, where the 
issue is not the redundant type declaration but rather the type 
system allowing implicit lossy conversions.
May 31 2020
parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 5/31/20 6:14 AM, Max Samukha wrote:> I was re-reading Walter's old 
article on redundancy and thought new
 people here might find it useful:
 https://www.digitalmars.com/articles/b05.html.
Thanks for the reminder. I read it again.
 It is good overall, except for a couple of arguable points, such as
 types of temporaries condemned as bad redundancy, where the issue is not
 the redundant type declaration but rather the type system allowing
 implicit lossy conversions.
Yes, implicit conversion is a concern but I didn't take the point that way: When the type is not spelled out, it means "whatever the type of the expression is." On the other hand, if one uses 'int' e.g. because the type of the expression is 'int' today, the compiler cannot know whether the programmer means "whatever the type of the expression is" or "I want specifically int". Note that 'int' conversion may not be lossy or wrong at all; there may be a perfectly valid 'int' conversion. The issue is, the compiler cannot know and that's why Walter calls this a bad redundancy. Ali
May 31 2020
parent Max Samukha <maxsamukha gmail.com> writes:
On Monday, 1 June 2020 at 06:53:05 UTC, Ali Çehreli wrote:

 Yes, implicit conversion is a concern but I didn't take the 
 point that way: When the type is not spelled out, it means 
 "whatever the type of the expression is." On the other hand, if 
 one uses 'int' e.g. because the type of the expression is 'int' 
 today, the compiler cannot know whether the programmer means 
 "whatever the type of the expression is" or "I want 
 specifically int". Note that 'int' conversion may not be lossy 
 or wrong at all; there may be a perfectly valid 'int' 
 conversion.

 The issue is, the compiler cannot know and that's why Walter 
 calls this a bad redundancy.

 Ali
It seems you can look at it this way as well.
Jun 01 2020