2 ms·
> this post is specifically about pascal - my comment about {} vs begin...end was intended for that context That link was Pascal. It was just one of many diale
by hnlmorg 3y ago
> this post is specifically about pascal - my comment about {} vs begin...end was intended for that context
That link was Pascal. It was just one of many dialects of Pascal.
> pascal has no way of defining variables within a local scope
I just did a quick search and turns out Pascal does support nesting variable scopes too.
> it was added to delphi as a kludge much later
Is it a kludge though? Or are you just calling it that because it disproves your point? The syntax is pretty similar to a lot of C-like languages. So you’d be calling their variable declarations a kludge too.
It feels like you’re being overly dismissive.
> i admit i should have said something like "... {} in C and C++".
it certainly would have helped your case to have opened with a little more context rather than assuming other people don’t understand how scoping works ;)
But even that aside, Pascal does support scoping inside compound statements.
Begin End and {} are just tokens to denote the start and end of a compound statement. Just like how Python uses indentation to group compounds.
Everything else you put is missing the point about how language grammar is parsed.
- Lerc 3y agoWell the good thing about this thread is that I found out that Pascal has grown inline vars since I last used it. With type inference too by the looks of it. Maybe I will make my way back after all.