News for hackers. Stuff that matters.
Re:Why Pascal Is Not My Favorite Programming Language (1981) by clouddrover on Monday February 25, 2019 @06:31AM (#19244837)
> It's really stressful to predeclare pointer types before using them

Depending on what you're doing exactly there are things you can do to mitigate that. If you're using records, you can just pass the record by reference instead. If you're using objects then you don't often need separate pointer types to them (the object reference is a pointer itself). If it makes sense for what you're doing you can also use untyped parameters:

http://docwiki.embarcadero.com/RADStudio/Rio/en/Parameters_(...

If you don't need to actually deference the pointers you can use the Pointer type (and if you still need to get at the data in some circumstances you can cast to a typed pointer inside the function):

http://docwiki.embarcadero.com/RADStudio/Rio/en/Pointers_and...

Re:Why Pascal Is Not My Favorite Programming Language (1981) by jstimpfle on Monday February 25, 2019 @06:34AM (#19244855)
Yes I know these workarounds but I don't think they are better than typedefs. Instead I simply want the obvious and readable thing that doesn't try to hide what happens and that doesn't require extra keyboard typing.
Re:Why Pascal Is Not My Favorite Programming Language (1981) by clouddrover on Monday February 25, 2019 @06:42AM (#19244894)
> I don't think they are better than typedefs

Why? Passing a record by reference looks like this: procedure SomeProc(var AMyRec : TMyRecord);

Passing an object reference looks like this: procedure SomeProc(const AMyObj : TMyObject);

I don't see that these are somehow onerous or hiding anything.

Re:Why Pascal Is Not My Favorite Programming Language (1981) by jstimpfle on Monday February 25, 2019 @06:58AM (#19244990)
Sure. When used they look like normal variables. And when you set them it looks like setting a local variable. This is hiding that what really happens is it's writing through a pointer. And it's modifying the caller's state.

Add to that the unfounded non-orthogonality (like in C++, references are technically the same as pointers, but not syntactically, and not in the type system, leading to combinatorial explosion. And of course the bloated standard library is proof).

Furthermore this approach doesn't work for pointers that point to arrays. Again, Delphi has its own zoo of workarounds that OOP enthusiast will think are so much better -- from dynamic arrays (really weird interactions with reallocations combined with "var" modifier or not), to ObjectLists (not typed) to a version of generics (has its own technical problems). But what I want is the simple and obvious thing (pointer parameters without typedefs) and there's no good reason why we shouldn't have it.

Re:Why Pascal Is Not My Favorite Programming Language (1981) by clouddrover on Monday February 25, 2019 @07:11AM (#19245046)
> This is hiding that what really happens

There is no ambiguity and nothing is hidden. Both examples are passing a reference to the procedure and all Pascal programmers will know what it means.

I think your argument boils down to a lack of experience with Pascal (which is fine). But these things you think are problems simply aren't.