Hacker Newsnew | past | comments | ask | show | jobs | submit | anta40's commentslogin

Say to strictly enforce modularity, e.g helper functions that can only be accessed within its function.

Pascal supports it (at least Turbo Pascal, no idea about ISO Pascal).


For a counterpoint, see David R. Hanson's "Is block structure necessary?" (1981) [0] — back in those days, "block structure" meant nested routines with nested scopes — which argues that having instead a proper module system, with explicit control over what's being exported from a module, not only gives a better modularity, decomposition, and encapsulation, but also simplifies both the language's implementation, and the run-time structures it needs (remember displays, and the hardware support for them e.g. x86's ENTER?).

    Block structure is traditionally considered an a priori requirement for algorithmic program-
    ming languages. Most new languages since Algol-60 have block structure. Reasons exist,
    however, to omit the general form of block structure — nested procedure definitions in which
    references to identifiers defined in outer procedures are permitted — from programming
    languages, especially those intended for systems programming applications. This paper
    reviews the concept of block structure and considers its advantages and disadvantages. It
    concludes that, in many cases, a module facility is superior to block structure and should be
    considered in lieu of block structure in future languages.
[0] https://drh.github.io/documents/blockstructure.pdf


The traditional way of doing this in C is simply static functions. Every .c file has exactly one non-static function and all the other helper functions are static.


What about Gambit? Perhaps it's a better, optimizing compiler but the built-in library is rather minimalist?


>> And that's part of the reason why in 2002, Switzerland's government reduced the Sonnenberg bunker capacity from 20,000 to just 2,000. Its floors filled with bunk beds, a prison and hospital, all deep underground, have been repurposed over the years as overflow housing for refugees, asylum seekers and the homeless. It's a use that has been criticized by organizations that help these populations. Some asylum seekers have protested against being housed here. It has never been used for its original intent: to protect people from nuclear fallout. But the Swiss government continues to spend tens of millions of dollars a year to maintain it and hundreds of thousands of other bunkers throughout the country — just in case.

Oh well...


Since NASM/YASM is written in C, it's more portable. On my ARM Mac, NASM works fine.

FASM is cool (and still being development), but since it's written in 32-bit x86 asm, let's just say macOS is a 2nd class citizen.


You mean this:

https://www.amazon.com/Art-ARM-Assembly-Randall-Hyde/dp/1718... ?

Mmm nice. Will give it a try since ARM-based Mac is my main working environment nowadays.


You might also want to checkout the Assembly books by Larry Pyeatt (ARM only) and Daniel Kusswurm (x86 + ARM).

Another excellent classic which you should checkout if you are interested in all things ARM is ARM System Developer's Guide: Designing and Optimizing System Software by Sloss, Symes and Wright. It is old and so does not cover newer ARM architectures but will give you a solid foundation for system programming.


Mr Kusswurm's x86 book is excellent. Didn't know he also write on for ARM. Thank you!


Not exactly weird... I mean x64 Windows is still pretty popular. And pretty much any Windows dev will have Visual Studio installed (to get MASM).

Unless, you want to use open source MASM-compatible assemblers like JWASM or UASM.

Yes I understand, other folks may prefer Linux/BSD, NASM/FASM, ARM etc etc.


>> but personally I'd like to teach my kid how a computer works, not how to use some programming language.

I wonder if assembly is a better choice... hmmm...


Well one can follow on from the other.

Assembly is add R1 R2. Forth takes the 2 numbers from the TOS and puts it in those registers. That wasn't obvious what was happening in the post, I wonder if student me would have wondered.

You could make the case for going all the way down to the silicon.

We teach English, maths, science to give a rounded understanding, not to make student productive or give them information that will be immediately useful. IT/computing in secondary school should be doing a similar thing. It should remove the mystery of what a computer is. That it is programmable. Hopefully it's improved since I was young and we were basically shown how to use Excel.


Does this mean I can turn my JS-based backend into single executable and easily ship it, like in Go?


Recent versions of Node can package a backend into a single binary already, it'll just be 100MB+ and embed the whole Node runtime.

This is more equivalent to Go, with a single static native binary that does not include the whole Node runtime


Works fine on 152.0.5 (aarch64) macOS 26.5.2. I don't use extensions like NoScript etc etc


If you like QuickBASIC, perhaps FreeBASIC is also an interesting choice.

For many years, it practically only supports Windows, Linux, and DOS. Now add macOS into the list: https://deb.fbxl.net/macos/


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

Search: