Why are structs and classes so different?
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Thu May 19 06:45:34 UTC 2022
On Wednesday, 18 May 2022 at 10:53:03 UTC, forkit wrote:
> Here is a very interesting article that researches this subject.
Yeah, he got it right. It is syntax sugar that makes verbose C++
code easier to read. Use struct for internal objects and tuple
like usage and class for major objects in your model.
But Simula used class for more: coroutines and library modules.
So, you could take a class and use its scope in your code and
thereby get access to the symbols/definitions in it.
The successor to Simula, called Beta, took it one step further
and used the class concept for functions, block scopes, loops,
almost everything.
The language Self went even further and collapsed the concept of
class and object into one... perhaps too far... People prefer
Typescript over Javascript for a reason. 😁
More information about the Digitalmars-d-learn
mailing list