remko / waforth

Small but complete dynamic Forth Interpreter/Compiler for and in WebAssembly
https://mko.re/waforth
MIT License
497 stars 27 forks source link

Why only upper case commands work? #51

Closed FoundOne closed 1 year ago

FoundOne commented 1 year ago

Isn't FORTH a case insensitive programming language? How to reproduce:

  1. Open the online demo at https://el-tramo.be/waforth/
  2. Enter 1 2 3 .s What it should do: It should print the stack, i.e. 1 2 3 ok What it does: Throws an error: undefined word: .s
remko commented 1 year ago

According to 3.4.2, case insensitivity is implementation-defined, and only the upper case version has to work.

I sometimes hesitate whether to make name lookups case insensitive, but it's not code that brings be much joy (and could break compatibility with case-sensitive systems).

nagy commented 1 year ago

One use-case where this might be important is when loading third party packages. Because other forth implementations support lowercase as well, package authors tend to go with that variant sometimes.

For example, https://theforth.net/package/sprintf/current-view/sprintf.fth