6 ms·
Pascal family languages parse quickly because they won't let you use anything before it's defined.
by JulianMorrison 4y ago
Pascal family languages parse quickly because they won't let you use anything before it's defined.
- deleted 4y ago[deleted]
- lloydatkinson 4y agoProbably a controversial opinion, but I absolutely wish this was more common. It's a thing in F# as well. With JS/TS projects I always ensure the ESLint rule for only using what's been declared before is enabled. I don't want to scroll up and down a file constantly when referring to previous things that might reference something at the bottom of the file, which then references something near the top, which then references something in the middle, which then references something at the bottom again... I despise working in that manner.
- quickthrower2 4y agoI find it a non issue when you can use go to definition and go to previous position shortcuts.
- lloydatkinson 4y agoThere's a reason book chapters are in order...
- lproven 4y agoTrue, AIUI, but there's a bit more to it than that. This paper is very readable and talks about Niklaus Wirth's ruthless approach to compiler optimization. https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.90.7173&rep=rep1&type=pdf https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.90...
- jdvh 4y agoThat's not why Pascal compiles quickly. Resolving undefined symbols isn't difficult or slow, it just means that you have to keep track of what's resolved and what's unresolved and that takes up memory, which was very precious back in the old days of Pascal. Pascal is designed for very fast single-pass compilation, but symbol resolution is only a small part of it.
- fm77 4y agoWell, not really. Consider the following: type ItemPtr = ^Item; SomeOtherType = record a,b,c:integer; end; Item = record Data:string; Next:ItemPtr; end; The first time the parser hits "Item", its not defined.
- pklausler 4y agoPascal require(s|d) a "forward" declaration on such a type, no?