Worst ideas/features in programming languages?
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Tue Nov 9 13:26:20 UTC 2021
On Tuesday, 9 November 2021 at 11:37:49 UTC, Atila Neves wrote:
> Correct, but then again, anything other than machine code is
> syntatical sugar. So is `throw new Exception("oh noes");`
No, syntactical sugar has nothing to do with the machine. It is
sugar if it can be fully/easily replaced by other language
constructs with no semantic/typing changes.
You technically can totally restructure a program with exceptions
to one without, it is a rather comprehensive transformation.
You usually treat exceptions as a separate construct when
reasoning about the type system.
>> It means you now loose context
>
> I don't see how.
In D you can throw a wide variety of exceptions and propagate
them without even knowing that they were thrown. D even retains
the exception chain… (perhaps too much context for most use
cases). Clearly you loose context by "?" in comparison? Python
also allows you to trace the stack… that is a lot of context…
More information about the Digitalmars-d
mailing list