digitalmars.D - Redundancy in languages by Walter
- Max Samukha (7/7) May 31 2020 I was re-reading Walter's old article on redundancy and thought
- =?UTF-8?Q?Ali_=c3=87ehreli?= (13/19) May 31 2020 Thanks for the reminder. I read it again.
- Max Samukha (2/14) Jun 01 2020 It seems you can look at it this way as well.
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
On 5/31/20 6:14 AM, Max Samukha wrote:> I was re-reading Walter's old article on redundancy and thought newpeople 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
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. AliIt seems you can look at it this way as well.
Jun 01 2020