NR Linter - [msg] Unreachable code

What confusion?

It's simple.

A constant is a constant unless it is an object at which point it is mostly constant but not quite.

WiseOldAsianManWithBeardGIF

:face_with_spiral_eyes:

The reason is that objects and arrays are accessed by reference. So when I say
let a = {x:1, y:2}
a is effectively a pointer to the object (or array), not the actual object. The reason javascript works like this is for efficiency, as if I now say
let b = a
then it is not necessary to make a copy of the object and put it into b (which would be onerous for large arrays or objects), but just point b to the object. So if I say
const obj = {x:1, y:2}
I am saying that obj is a constant pointer to an object, meaning that the pointer cannot change. Not that obj is a pointer to a constant object.

Personally I usually don't use const for objects and arrays as it is easily misunderstood.

Thank you for that Colin,

I can now see how it all comes together, it requires me to have a slight shift in my mind set. I wrote a lot of my stuff using this...

LDA 30H
MOV B.A
LXI H.41H
LXI D.61H
ANA A
ADDW: LDAX D
ADC M
MOV M.A
INX D
INX H
DCR B
JNZ ADDW
JMP XXXXH

8080 ASM

I will keep your explanation as an aide memoire. I get it, just need to remember it!:rofl:

We are obviously of the same vintage.

I learned and wrote 6502 Assembly and even learned to read but not write some IBM 370 mainframe assembly. But I always preferred FORTH. :smiley:

I loved the idea for FORTH but when I tried to use it for anything serious it didn't really work well for me.

It is certainly a VERY different way of thinking. It took me a while to get my head around it certainly. However, its ability to write code in a high-level language and yet compile down to something utterly tiny was a real draw back in the day where memory might be maxing out at a few kB rather than the GB we have today.

The famous example was that of an airport operations tool that was completely written in FORTH and ran on a very small computer.

I was using it on the BBC Micro and it was great there.

Had the BBC Micro and used it to develop some Hardware that a couple of us had developed. We then went on to writing the code for the 8080 which had a max (iirc) of 64kB of addressable EPROM for the program and the RAM was much less. CPU cycles and Memory usage were both critical things for us!

The closest I got to FORTH was the Opto22 PAC Controllers, they evidently ran on a version of Forth, but I didn't really interface with that directly.

Of course, things got very 'professional' when I add the CP/M Module with the Business Package Software and two 5 1/4" Disk Drives. :lol

Of the fun of it all.

Oooh, this looks fun. https://www.npmjs.com/package/webforth

I think we absolutely need to be able to code in FORTH within node-red. I am surprised that no-one has provided this already. Forget typescript, lets GO FORTH.

:smiley:

I look forward to seeing your function-forth node! :+1::man_mage: