[OT] Re: Redundancy in languages by Walter

Schrom, Brian T Brian.Schrom at pnnl.gov
Mon Jun 1 15:17:11 UTC 2020


My attempt to capture a couple  of ideas that maybe will inspire someone
to extend them to something useful, given the last week's of messages.

To  me,  the difference  between  'var  x =  expression'  and  'int x  =
expression' ideally  should be that  the expression inferred a  type and
the 'int' is an "assert" that  the 'typeof(expression)' is int.  I don't
want implicit conversion  at this point, I  want an error if  there is a
mismatch.[*]

Likely naively,  I think a  similar approach could apply  to attributes.
The function infer attributes and  when they are labelled as @something,
that  is an  assertion that  the function  is indeed  @something.  If  a
public symbol needs to be a  certain thing, then this becomes a contract
in the function signature.

FWIW, I fully agree with redundancy because this is how error correction
works with communication and the  examples in Walter's article are great
examples  where  the overhead  is  minimal  and  the benefit  is  great.
e.g. Claude Shannon et al.

Brian

[*]   I  acknowledge   this  likely   doesn't  work   with  C,   as  is,
compile-ability.   Though  I  think  the C-ABI  is  the  important  part
and  source compatibility  causes more  harm  than good  at this  point.
I.e. Ideally we'd  get rid of  the unexpected and inconsistent  C things
and make a more consistent D syntax.



More information about the Digitalmars-d mailing list