6 ms·
The Programming Language B (1973)
- paedubucher 5y agoIs this some kind of C--? scnr
- hnlmorg 5y agoI don't know what scnr means, but yes, B is literally `C--` as you put it. Basically B was based on BCPL, a really early systems language. Then B was rewritten as C. The next iteration of C was called C++ as a joke because it's C plus 1. Though there has since been another language created as an evolution of C called D From what I gather, B never really got much use outside of Bell Labs. But I might have missed some reports on other people using it.
- 1f60c 5y ago> I don't know what scnr means Wiktionary tells me it stands for "sorry, could not resist". https://de.wiktionary.org/wiki/SCNR https://de.wiktionary.org/wiki/SCNR
- BoxOfRain 5y agoApparently AberMUD (way before my time but developed in Aberystwyth where I was a student) was written in B.
- user2994cb 5y agoAnd BCPL was a cut down version of CPL: https://en.wikipedia.org/wiki/CPL_(programming_language) https://en.wikipedia.org/wiki/CPL_(programming_language)
- pjmlp 5y agoActually designed for Bootstraping CPL.
- user2994cb 5y agoLots of interesting details here: http://www.cl.cam.ac.uk/~mr10/cpl2bcpl.pdf http://www.cl.cam.ac.uk/~mr10/cpl2bcpl.pdf
- int_19h 5y agoYou can kinda see where C's weird i[a] notation for arrays came from, and even why.
- pornel 5y agoPointer variables in C are declared in an odd way, as `int (*a)` rather than `(int*) a`. I suspect this is also due to B's legacy. In B everything was an integer, and there was no separate pointer type. It had only pointer operators that could be applied to any integer.
- veltas 5y agoDeclarators (the name along with pointer, array, etc annotations) in C are written parallel to how they are used, I have always assumed this was to make defining/explaining the language simpler (even though it often defies new learner's expectations), and maybe to reduce the amount of required logic in the compiler. I think you're right that B is related to this, the reason the brackets were on the right of the name is because no type was mentioned in B (as there was only one type). If types had been named in declarations they probably would have preferred to do what Java does, i.e. `Type[] name`. The other more archaic reason the brackets are on the right is because in the oldest B compilers the brackets were not there at all, instead when declaring 'local' (auto) vectors you just write the length of the vector after its name, like `auto name 8;` would declare a vector length 8 called 'name'. Once again this syntax makes sense without the type. In B, declarators had not really matured yet, in some situations you could declare a vector with brackets similar to C arrays, but only of one dimension (which I think is why they were called vectors and not arrays).
- int_19h 5y agoOne thing that I've noticed when digging into historical programming languages of that time period, is that many of them didn't really treat arrays as a type, but rather as some kind of variable modifier - and then putting the brackets after the variable name makes perfect sense. Notably, Algol-60, the granddaddy of all the C-like languages, already had this syntax: begin integer x[1:42]; ... end
- yiyus 5y agoI like how constrained the language was: > All arithmetic in B is integer, unless special functions are written. There is no equivalent of the Fortran IJKLMN convention, no floating point, no data types, no type conversions, and no type checking. Users of double-precision complex will have to fend for themselves. (But see ->32 for how to call Fortran subroutines.) I wonder if it would have been beneficial to continue with this separation. Fortran and C started trying to do everything and they failed. Fortran was never a contender for C for systems programming, and C has not moved in the right direction to be better than Fortran for numerical computing.
- projektfu 5y agoFortran-90 is well constrained for numerical programming and has so much inertia in the scientific community, it’s probably not going away. But C and its derivatives are good enough at numeric work for most users outside of science. Many have tried to dislodge both C and Fortran from their positions, with varying levels of success. Maybe we’ll see it in the next decade as scientists who knew how to code before university dominate and no longer want to use Fortran.
- blacktriangle 5y agoHaving learned to code and getting a degree before going to get a job at a shop that had a ton of Fortran floating around, I'd say I grew to appreciate how direct it was for just doing math. And after working at later jobs where the scientists were allowed to write code in more expansive expressive languages than just Fortran, I really came to appreciate how Fortran enabled scientists to do science in such a way that they did not write unholy abominations of python code.
- yiyus 5y agoYou are absolutely right. To be honest, the current situation is not too different from this hypothetical case. Fortran is used mostly to write numeric routines and then we call them from a Python script, instead of writing text and arguments processing (for example) directly from Fortran. But I still find interesting thinking about where these languages would be if these limits had been consistently respected.
- aap_ 5y agoI wrote a B compiler: https://github.com/aap/b https://github.com/aap/b it generates the original threaded code and has a runtime for amd64, mips32 and riscv64. should get the pdp-11 one working too sometime... Documented the original pdp-7 and pdp-11 implementations here: http://squoze.net/B/ http://squoze.net/B/