PyBasic
                                
                                
                                
                                    PyBasic copied to clipboard
                            
                            
                            
                        System variables needed.
This is both an issue and a question on how this should be done in basic. This is a very complete Python Basic interpreter. I am replacing an old basic compiler from a Z80 system to run on a new device. I have a lot of legacy code. The old basic supported variables named like this:
my.day my.year
Sort of like making a record but it really was just syntax sugar to allow you to put a period in variable names.
I only mention that because it had system variables like the PI constant but rather than a constant it had system variables. like: DATE.DAY DATE.MONTH DATE.YEAR TIME.HOUR TIME.MINUTE TIME.SECOND
These all returned the current 24 hour for time and the numeric day, month, and year.
I have already modified my version of PyBasic that I forked to do this. by using _ instead of period. like:
TIME_SECOND
I am wondering if this is the right way and if you are thinking of adding this to PyBasic. It is System Agnostic. If the system does not support time you could return 0 if it does you could return the time.
If you do add it how would you add it. Is my way right or should it be a function that takes an argument like: DATETIME("HOUR")