TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Features of PL/I not realized in a modern language

97 pointsby vitplisterover 3 years ago

19 comments

adrian_bover 3 years ago
There are many other features of PL&#x2F;I besides those mentioned there, which are not encountered in modern languages.<p>Because PL&#x2F;I was designed by IBM for their computers and operating systems, there were no concerns for portability, so the language definition included a large amount of features that are left unspecified in standards for languages like C&#x2F;C++, because they are available only for certain operating systems or computers, so the standard must be restricted to specify only the minimum features that are available everywhere.<p>For example the C++ threads are limited only to the features provided by the POSIX pthreads, even if most operating systems have additional features for multi-threading. PL&#x2F;I on the other hand, already in 1965 had more powerful features than the C++ threads.<p>One feature of PL&#x2F;I that is completely absent in all modern languages is what I consider to be the right way for error handling.<p>Instead of being forced to test the return value of a function to determine what error might have happened, which is a redundant operation, as this was already tested once in the invoked function, and which clutters the code, obscuring the processing of the normal path, the PL&#x2F;I method was to group the error handlers at the end and pass the labels of the error handlers to the invoked function as alternative return labels.<p>While this looks visually very similar to a <i>try</i> block with exception handlers, the hardware implementation in PL&#x2F;I is far more efficient than in modern languages, because there are no conditional branches and no extra code to determine where is the appropriate error handler, just the return, which is done anyway when the invoked function finishes, jumps to different addresses in case of errors, instead of returning to the point of invocation.<p>PL&#x2F;I also had exceptions, but those were used for really exceptional conditions, like numeric overflow, illegal memory accesses etc., not for correctable error conditions, like a mistyped user input or a file that cannot be found, which are best handled at the point where a function has been invoked, because only there you have complete information about the intention of the failed operation.
评论 #29354614 未加载
评论 #29355507 未加载
评论 #29355196 未加载
评论 #29353900 未加载
评论 #29359243 未加载
评论 #29396014 未加载
评论 #29353943 未加载
评论 #29354692 未加载
npsimonsover 3 years ago
Upvoted simply out of controversy and curiosity.<p>It&#x27;s been a long time, and I&#x27;ve not delved deeply in to a wide swath of languages (recently), but surely the features he&#x27;s citing are in other languages? Hell, even the list of &quot;features only Lisp has&quot; keeps shrinking by the decade. Some of these PL&#x2F;I &quot;features&quot; feel like things you could trivially implement in a library in other languages (ie, not have to implement half of PL&#x2F;I to get those features). Some of it sounds simply like syntactic sugar, and not actual features.<p>What am I missing here?
jdouganover 3 years ago
My personal favorite feature in PL&#x2F;1 was the zero overhead matrix transpose. You achieved this by mapping two matrix declarations onto the same storage, one specifying column-major and the other row-major. We used to joke the PL&#x2F;1 declaration system was turing-complete.
评论 #29358958 未加载
mgraczykover 3 years ago
Generally in modern languages you use libraries rather than language features, which IMO is better and shows that the language is generic enough to allow programmers to build abstractions as needed.<p>However, some of these (#4 in particular) are exactly supported in other &quot;modern&quot; languages.<p><pre><code> 1. Assignment by name. python: A = {**A, **B} javascript: A = {...A, ...B}; 2. Both binary and decimal data For these you use libraries like Decimal in python, boost::multiprecision in C++ 3. Bit strings of arbitrary length vector&lt;bool&gt;, boost::dynamic_bitset, or write your own in python you would use numpy 4. A named array is normally passed by reference, as in F(A) In C++ you can do this for any type with a copy constructor. void f(A_Type&amp; A) { ... ... = f(A); &#x2F;&#x2F; by ref ... = f({A}); &#x2F;&#x2F; by value 5. IO by name. Not generally done as far as I&#x27;m aware, but you could easily build this in C++. Something like class StdOut { void operator=(string s) { cout &lt;&lt; s; } }; StdOut{} = &quot;hello\n&quot;; 6. SORT statement Why not sort function? c++ std::sort, python sorted() builtin 7. Complete implicit conversion Javascript is the KING here, and we all know how helpful that is.... Of course C++ let&#x27;s you define this yourself, but there isn&#x27;t directly language support.</code></pre>
评论 #29368035 未加载
评论 #29371823 未加载
BXLE_1-1-BitIs1over 3 years ago
PL&#x2F;I was an order of magnitude step from Fortran and Cobol. The earlier languages made direct calls to the operating system while PL&#x2F;I used subroutine librairies to do the operating system heavy lifting. The library routines in many cases would produce messages of various utility (usually with the number of the failing statement) instead of causing the application to terminate aka ABEND.<p>Yes, you can use bit strings in PL&#x2F;I, but the subroutine overhead was ginormous.<p>This is simply the worst case of PL&#x2F;I data conversion routines. PUT EDIT and GET EDIT are somewhat less costly.<p>Structures are a two edged sword. Best to have them STATIC in the owning routine and have them based on pointers for other routines. Otherwise the prolog code can dwarf the code that does useful work.<p>PICTURE works very well in structures. Assigning between structures with fields of the same name in one PICTURE, and the other in machine format can often be performed without resort to data conversion routines.<p>Bottom line: Many advertised features are costly while PL&#x2F;I offers remarkably efficient alternatives.
bigbillheckover 3 years ago
&gt; 7. Astonishingly complete set of implicit data conversions. E.g. if X is floating-point and S is a string, the assignment X = S works when S = &quot;2&quot; and raises an exception (not PL&#x2F;I terminology) when S = &quot;A&quot;.<p>This seems like an extraordinarily bad idea.
评论 #29353793 未加载
评论 #29353945 未加载
评论 #29353870 未加载
评论 #29354028 未加载
musicaleover 3 years ago
PL&#x2F;I was also memory safe (unlike C&#x2F;C++), and on Multics the stack grew up rather than down.<p>Probably the greatest reliability regression from Multics to Unix was implementing the kernel and user apps in an unsafe language.<p>(Or, more accurately, using an unsafe compiler&#x2F;ABI, as there have been memory-safe compilers&#x2F;runtimes for ANSI C such as Fail-Safe C.)
Someoneover 3 years ago
Another feature: keywords aren’t reserved words. For an example of where that can lead to see <a href="https:&#x2F;&#x2F;multicians.org&#x2F;proc-proc.html" rel="nofollow">https:&#x2F;&#x2F;multicians.org&#x2F;proc-proc.html</a><p>The thinking behind that was that the set of keywords would grow over time, and that you couldn’t expect any programmer to know all of them.<p>There likely also are few programmers who do know all of them, as there are hundreds (see <a href="https:&#x2F;&#x2F;www.kednos.com&#x2F;pli&#x2F;docs&#x2F;reference_manual&#x2F;6291pro_042.html#append_key" rel="nofollow">https:&#x2F;&#x2F;www.kednos.com&#x2F;pli&#x2F;docs&#x2F;reference_manual&#x2F;6291pro_042...</a> for those of one implementation)
评论 #29357662 未加载
评论 #29354674 未加载
the_only_lawover 3 years ago
&gt; Bit strings of arbitrary length, with bitwise Boolean operations plus substr and catenation<p>This one actually piqued my interest in PL&#x2F;I recently. Closest thing I’ve seen in modern languages is bitstrings in the BEAM.
评论 #29358432 未加载
评论 #29354634 未加载
评论 #29354416 未加载
评论 #29358964 未加载
throwawayboiseover 3 years ago
Used PL&#x2F;1 in one of my first programming classes at university. Never before or since, but I don&#x27;t recall it being a bad language to work in.
评论 #29354230 未加载
评论 #29353814 未加载
stackedinserterover 3 years ago
To me it looks like a list of ways to shoot yourself in the foot or get a pagerduty call at 3am.<p>E.g. what&#x27;s good about automatic conversion between float and str? It can save you a minute or two if you&#x27;re making a PoC or fiddling around in a notebook, but it&#x27;s hiding real issues in your data flow if you&#x27;re developing something for production use.
teddyhover 3 years ago
Point 7 simply means that PL&#x2F;I is very weakly typed. However, weak typing seems to now be unused in all modern languages; strong typing seems to be the current norm. (Not to be confused with static&#x2F;dynamic typing, which is orthogonal.)
jhallenworldover 3 years ago
I think the more relevant language was PL&#x2F;M (actually PL&#x2F;M-86) since it was available for 8086 early on. I don&#x27;t think PL&#x2F;M had any of these features, and C for the 8086 was better than it so that was the end of it.<p>Maybe if IBM chose 68K for the PC, we would have gotten the full blown PL&#x2F;I.<p>Edit, well actually I found this &quot;X3.74, PL&#x2F;I General Purpose Subset (Subset G)&quot; from 1983. This version at least has strings.<p>Look at manual disk here:<p><a href="https:&#x2F;&#x2F;winworldpc.com&#x2F;product&#x2F;digital-research-pl-i-compiler&#x2F;1x" rel="nofollow">https:&#x2F;&#x2F;winworldpc.com&#x2F;product&#x2F;digital-research-pl-i-compile...</a>
tofflosover 3 years ago
&gt; 1. Assignment by name. If A and B are structs (not official PL&#x2F;I terminology), then A + B A = B copies similarly named fields of B to corresponding fields in A.<p>Do you mean something like with-expressions? See <a href="https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;dotnet&#x2F;csharp&#x2F;language-reference&#x2F;operators&#x2F;with-expression" rel="nofollow">https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;dotnet&#x2F;csharp&#x2F;language-refe...</a>.
评论 #29359366 未加载
评论 #29358897 未加载
hungryforcodesover 3 years ago
It&#x27;s not really mentioned in the thread so far, but weirdly... PL&#x2F;I was one of the inspirations for PL&#x2F;M, which was the basis for CP&#x2F;M... which was the basis for DOS... which led us to Windows... which leads us to today for those that don&#x27;t use other OSs, etc, etc.
评论 #29361251 未加载
ptxover 3 years ago
&gt; <i>4. A named array is normally passed by reference, as in F(A). But if the argument is not a bare name, as in F((A)), it is passed by value.</i><p>Visual Basic (VB6&#x2F;VBA) does exactly this, with the same syntax (except without the outer parentheses if the call is a statement).
评论 #29359770 未加载
评论 #29354273 未加载
评论 #29358179 未加载
denton-scratchover 3 years ago
I used PL&#x2F;M at one time - PL&#x2F;M for microprocessors. It was an Intel compiler. PL&#x2F;M was a subset of PL&#x2F;1, I think with 64Kb object segments (which suited 8086 architecture). It was a nice, predictable systems programming language.
manbartover 3 years ago
I think 2,3,5 and 7 apply to Rexx as well, another IBM created language. I wouldn’t call it modern however
评论 #29353948 未加载
kgeistover 3 years ago
&gt;If A and B are structs (not official PL&#x2F;I terminology), then A + B A = B copies similarly named fields of B to corresponding fields in A.<p>In Go, you can copy a variable of type A to a variable of type B if the types have similarly named fields of same types, although an explicit cast is required.