allow alias to blocks

This commit is contained in:
Irmen de Jong
2026-02-10 22:37:07 +01:00
parent d6c8fc0c61
commit 3f181b0ede
5 changed files with 8 additions and 18 deletions
+4 -2
View File
@@ -125,8 +125,10 @@ The ``alias`` statement makes it easier to refer to symbols from other places, a
you from having to type the fully scoped name everytime you need to access that symbol.
Aliases can be created in any scope except at the module level.
An alias is created with ``alias <name> = <target>`` and then you can use ``<name>`` as if it were ``<target>``.
It is possible to alias variables, labels and subroutines, but not whole blocks.
The name has to be an unscoped identifier name, the target can be any symbol.
It is possible to alias variables, labels and subroutines, and even whole blocks.words
The name has to be an unscoped identifier name, the target can be any scoped or unscoped symbol.
Please consider using aliases sparingly because it may lead to confusing code if you alias
well-known block names for example.
.. _blocks:
+1 -1
View File
@@ -13,7 +13,6 @@ Future Things and Ideas
- make builtin functions capable of returning multiple values, then make divmod() return the 2 results rather than accepting 2 extra variables as arguments
- then also introduce lmh(longvalue) -or whatever sensible name- builtin function that returns the low, mid, hi (bank) bytes of a long.
- and rewrite the divmod (and others?) function to just return the 2 results instead of taking target variables as arguments.
- allow alias to blocks? There's some code look for "experimental code to be able to alias blocks"
- add a -profile option (for now X16 only) that instruments the start (and returns?) -of every prog8 subroutine with code that dumps to the X16 emulator debug console: name of sub, stack pointer (for call depth!), emudbg cycle count. Save/restore all used registers! Start of program must set cycle count to zero.
- add @private to variables and subroutines declared in a scope to make them invisible from outside that scope?
- when implementing unsigned longs: remove the (multiple) "TODO "hack" to allow unsigned long constants to be used as values for signed longs, without needing a cast"
@@ -110,6 +109,7 @@ IR/VM
Libraries
---------
- add a string to long conv routine
- Add split-word array sorting routines to sorting module?
- make a list of all floats.* routines that the compiler expects for full float support?