Replies: 3 comments 2 replies
-
In Gforth, float local variables are defined using a preceded type specifier I dislike the space between a type specifier and a variable name because it makes readability worse. I would prefer a syntax like this: For example: |
Beta Was this translation helpful? Give feedback.
-
When we implemented this in Gforth about 30 years ago or so, it was easier to parse that way. Nowadays, the locals defining recognizer is just a recognizer stack (new-locals-rec and locals-types), so parsing {: r:x xt:func :} is not difficult (and could even be added later as user-written extension). There are at least two possibilities
|
Beta Was this translation helpful? Give feedback.
-
Am 30. August 2024 15:55:10 MESZ schrieb ruv ***@***.***>:
I'm just not sure abut `xt:func`. What if we want to specify the _xt_ data type for a stack parameter, and want the corresponding local variable to return that parameter (i.e. without execution it). Do we instead have to only use `['] func` or a special syntax like `xt:func`, `'func` (or Gforth's ``` `func```)?
Use `action-of`; we treat xt: locals like deferred words.
--
Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o id: ***@***.***}1GWr!+0qqp_Cn176t4(dQ*
https://net2o.de/
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Was looking at the Forth 2019 draft of the Locals words set and was curious about locals for floats. In a mix data float stack Locals would work without change, in a separate data and float stacks system, the Locals word set would only apply to the data stack.
Curious as how to apply Locals for both data and float stacks (mixed or separate). Should
{: ... :}
introduce a delimiter,:f:
to separate data from floats, eg.{: a b :f: x y :}
?Beta Was this translation helpful? Give feedback.
All reactions