News for hackers. Stuff that matters.
Re:Pharo 11 by 542458 on Thursday May 11, 2023 @10:07AM (#35902296)
The "fusion of a developed program and development environment" idea is very cool.

One question though:

> Simple & powerful language: No constructors, no types declaration, no interfaces, no primitive types.

Are constructors and primitive types really the sort of things that people find to be unnecessary complexity?

Re:Pharo 11 by emaringolo on Thursday May 11, 2023 @10:23AM (#35902534)
Many languages need constructors (and static methods) because the class is not an object.

In Smalltalk the class is the sole instance of another class (MetaClass), so a "static method" becomes a "class-side" method. And so it is inheritable.

The meta relationship is hard to understand (at first), but it is part of what causes the parsimony in all the interactions, and the "everything is an object". https://stackoverflow.com/questions/57898036/is-it-true-that...

Primitives (as in int, double, etc.) are a different subject, and although an Integer or a Smallinteger is a specially optimized object, it has the overhead of being an object (as in "Boxed" Integer in other languages), instead of some bytes at some memory location.

Most of the times you don't need the optimized version, and if were the case that you do, then it's when you optimize that piece of execution specifically (maybe making an external call to a more low-level, optimized version).

Re:Pharo 11 by Cthulhu_ on Thursday May 11, 2023 @10:20AM (#35902486)
Constructors are tools to put an object in a starting state, but there's alternative solutions; in Go, factory functions are pretty common.

Primitive types reminds me of Java, which doesn't have primitive types per se (everything is an object under water), but they're adding it soon (or already have) for performance reasons.

Re:Pharo 11 by jolux on Thursday May 11, 2023 @10:28AM (#35902600)
Java does have primitives/unboxed types (int, long, boolean, etc) what they’re adding is support for unboxed/value classes created by users. This should help reduce the duplication between int and Integer and so forth.
Re:Pharo 11 by zabzonk on Thursday May 11, 2023 @10:19AM (#35902473)
you can (and often do) have constructors in smalltalk: https://stackoverflow.com/questions/36878787/making-a-constr... - i think the stuff you quoted was probably written with little thought.
Re:Pharo 11 by scotty79 on Thursday May 11, 2023 @01:29PM (#35905394)
Primitive types are really annoying.

If they were about what user needs not about underlying hardware they'd be fine.

I dont care about int, long, float or double.

I care about number to represent whole amount, or fractional amount or approximate amount with operations that work accordingly lile approximate comparison of approximate numbers. Approximations for when I care about approximation error and for when I don't. Number that are limited to the ranges I care about not some arbitrary MAX_INT. Numbers that have units so that I won't accidently assigned a length to a variable that should hold mass.

So yeah, as they are primitive types do introduce unnecessary complexity and none useful complexity unless you want to work close to the metal.