Hacker News new | past | comments | ask | show | jobs | submit login

FWIW Wirth's Pascal does not have a writeln, only write and you are supposed to use a special EOL character to indicate end of line.

But yes it is meant to be special (like read) and also has its own special syntax for formatting. However this isn't anything weird as the compiler was already implementing all other standard procedures and functions as part of the language itself anyway - there isn't a distinction between 'language' and 'runtime library' like you'd see in C for example.




Yes, but what I mean: he saw that the language was not expressive enough to handle a common and useful case. One should start to think about it, and not say 'oh well, since I am the language designer I solve it at compiler level'. I mean what if I want to write a function which formats things like writeln into a string (to allow for different decimal separators, or whatever).


Wirth did "start to think about it": He developed Modula, Modula-2, Oberon, Oberon-2, Oberon-07.

It was not addressed in his Pascal versions because he moved on from Pascal, not because he didn't recognise that Pascal was too limited for many use-cases.


Well, i can't speak for Wirth so i don't know why that didn't happen but my guess is that he either didn't think about it (i mean Pascal was already very expressive for its time) or it would considerably complicate both the language and memory handling for an arguably niche use case (remember that write not only accepts variable number of arguments but also different data types - and that doesn't even take into account the special syntax for padding, number of digits for reals, etc).

It is better to think read/write as akin to 'while', 'if', etc than as regular procedures. Making your own 'if' might be neat, but not something you'd see often outside of Lisp :-P


... and Forth :)


When people say there are two kind of languages, functional or procedural, then forth is the 3rd kind.


You are incorrect. Wirth Pascal has writeln, and in fact that is the only well-defined way to output a “newline”. There is no notion of \n or \r. (Gory details: when eoln(f) is true, the file variable f^ is supposed to be the space character!)


AFAIK this is Wirth's last document/version of Pascal:

http://pascal-central.com/docs/pascal1973.pdf

It doesn't mention Writeln anywhere. In section 13 (page 39) "Input and Output" it only mentions read and write for text input/output and at the end of it mentions that the end of each line must be indicated with the EOL characer. A few pages later (page 44) there is a table of standard identifiers and there is no mention of writeln either (but there is of write).


Writeln is certainly in Wirth’s “Silver Book” Pascal standard, hot off his horrible line printer in 1974: https://dl101.zlibcdn.com/dtoken/78641b52ce049f6f7825c9e8f81...


This looks like the manual for the Pascal 6000 compiler they had at ETH Zurich which extended the language that Wirth described. In fact in the preface it mentions that the standard is the "The Programming Language Pascal (Revised Report)" which in footnotes mentions is the 1973 version - ie. the document i linked above.

Confusingly enough though it does describe readln and writeln in an attached revised report (mentioning that the reason for their addition is that they can't rely on an EOL character being available) but this is not the text they cite as the standard Pascal nor the latest version of the report available from ETH themselves (which is basically a different scan of the same text i linked above): https://www.research-collection.ethz.ch/handle/20.500.11850/...

My guess is that they added these at some point later but didn't make a newer version of the standalone report (which is what i've seen in other places, e.g. http://pascal-central.com/standards.html refer as Wirth's last standard). I guess in practice it was simpler to have a single book act both as a tutorial and a reference, though i always though the 1973 report to be the last "standard" and didn't paid much attention to the other stuff released later.


Quoting the "Preface to the Revised Report" in my link: "...the language defined in THIS Revised Report is called STANDARD PASCAL." Two paragraphs later: "... the new procedures READLN, WRITELN, and EOLN have been included in the set of standard procedures..." Sorry that ETH has outdated stuff, but this is an accurate image of the actual, physical book authored by Wirth, as published and sold by Springer-Verlag, in which he says it describes STANDARD PASCAL. I have it in my possession if you don't believe the scans that are on the internet.


Uh yes, i believe you, i just mentioned that it is confusing that the first part of the manual refers to the 1973 report as the standard Pascal and then the report in the second part is not the exact same text and that the last revision available from ETH is not the latest one (most likely because there wasn't a standalone version made) doesn't help.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: