View previous topic :: View next topic |
Author |
Message |
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Wed Dec 15, 2004 9:36 am Post subject: Syntax change... |
|
|
I was thinking that the implementation of VDS could be improved if the syntax was changed so that the runtime allocated the identifier for string lists, files and so on instead of the programmer picking an arbitrary number.
Example:
Code: | # old way
LIST CREATE,23
# suggested change
%%mylist = @new(list)
|
Any thoughts about this? _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Wed Dec 15, 2004 12:51 pm Post subject: |
|
|
hi jules,
i would be concerned about backward compatibility in that if i wanted to compile one of my programs using vds 6 with the suggested format, i would then have to go through all my code to make all the necessary changes and then to have to test it all to make sure that i made the correct changes - a potential serious headache
i kinda like the old way in any case, may be because i am used to it now
perhaps both?
serge _________________
|
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Wed Dec 15, 2004 1:38 pm Post subject: |
|
|
This is the kind of feedback I'm looking for. However, I want to make the suggestion that backward compatibility can hamper development of a language, for the sake of avoiding a once-only conversion. It would be possible to keep both methods only if VDS kept the existing way of doing things, which is basically to have a fixed array of each type of object. Some of the things VDS does now, it does only because nobody took the trouble to work out a better way of doing things. For example, by allowing the system to specify the ID, the VDS runtime can avoid having to create 32 string list holders just in case the programmer picks 32 for the list number. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Dec 15, 2004 1:47 pm Post subject: |
|
|
Serge,
I could make a tool that could convert the List's syntax to any new syntax that VDS 6 will use. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
marty Professional Member
Joined: 10 May 2001 Posts: 789
|
Posted: Wed Dec 15, 2004 1:58 pm Post subject: |
|
|
Good idea Jules!
But we need a converter within the VDS 6 IDE when a VDS 5 or lower is loaded I think.. |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Wed Dec 15, 2004 2:06 pm Post subject: |
|
|
jules,
i am all for vds becoming more efficient and better - my only concern really is having to deal with my main program that has 2000 lines of code and having to change the syntax for it
perhaps the vds REPLACE menu command could help with that with, for example, REPLACE LIST CREATE,2 with %%NEW_LIST = @NEW(LIST)
something i just thought of - using your suggested function "takes away" from the LIST notion...not sure i am expressing myself right
how about? Code: | LIST CREATE, %%NEW_LIST | this way it still remains part of the LIST arsenal
does that make sense?
dragonsphere,
that would help a lot, thanks
serge _________________
|
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Wed Dec 15, 2004 4:17 pm Post subject: |
|
|
Serge wrote: | jules,
i am all for vds becoming more efficient and better - my only concern really is having to deal with my main program that has 2000 lines of code and having to change the syntax for it |
Yes I understand that. On the other hand, if you've got a big program. you have probably found as I have that you can't remember which lists have been used, and there is no easy way to find out. With the new method, you don't have to worry about what the list ID actually is, so maintenance of the program will be easier in the future.
Serge wrote: | perhaps the vds REPLACE menu command could help with that with, for example, REPLACE LIST CREATE,2 with %%NEW_LIST = @NEW(LIST) |
Well, yes, but you also have to replace 2 with %%new_list in all the other list commands and functions that use it. However, we know what these commands and functions are, and where the list identifier is, so it ought to be possible to make a converter script that will do it.
Serge wrote: | something i just thought of - using your suggested function "takes away" from the LIST notion...not sure i am expressing myself right |
I get what you are saying, but you already use functions that don't contain the word LIST to access lists, so I think you would get used to it.
Serge wrote: | how about? Code: | LIST CREATE, %%NEW_LIST | this way it still remains part of the LIST arsenal |
In a language like Pascal or C, that would be possible, because you can specify whether an argument is the value of a variable, a copy of the value of a variable, or a pointer to the actual variable (which allows the command or function to change it.) VDS is a string interpreter. In commands and on the right and side of an equals, a variable name is always replaced by its contents before it is passed to a command or function. You can only set a value into something on the left hand side of an equals sign. That's one of the simplifications that help make VDS easy to use, but we're stuck with the way it works. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Dec 15, 2004 6:16 pm Post subject: |
|
|
Jules wrote: | VDS is a string interpreter. In commands and on the right and side of an equals, a variable name is always replaced by its contents before it is passed to a command or function. You can only set a value into something on the left hand side of an equals sign. |
The parse command does replace the value of variables, without they have to be on the left side of an equal sign. I personally think Serge's solution is the easiest to use, because the syntax keeps the same as it is now. When using a function like @new(list), I think people might get confused sooner, because that will be the only list-function which actually is a command... _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Wed Dec 15, 2004 7:00 pm Post subject: |
|
|
The parse command is a kludge. As you know, you have to put the variable names in quotes to stop their values being substituted in by the interpreter. It's an awkward solution that I'd rather not see in something used as often as creating a stringlist. The number of times the parse command doesn't work because forgot to put the quotes in...
However you look at it:
Code: | %%mylist = @new(list) |
@new is not a command, it is definitely a function. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Thu Dec 16, 2004 9:56 am Post subject: |
|
|
Yes. There will be @new(binfile) and @new(xmldoc), and possibly some others. I think when you get the chance to try it, you'll find that it is a better way of working with these types of objects, but in view of the dislike that has been expressed of removing the old way of doing things, I'll probably have to give up on the idea of changing the way it works internally, so both old and new methods can coexist. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
JRoza Contributor
Joined: 17 Aug 2003 Posts: 182 Location: Netherlands
|
Posted: Thu Dec 16, 2004 9:48 pm Post subject: |
|
|
Jules
Like (almost) any programmer I'm a little reserved about changes to the syntax we're used to. But I like what I see so far and to be honest with a little effort I'll get used to the new syntax soon. So - if there will be some handy conversion tool to change old coding to the new syntax - I'm all for it.
I understand the @new but can you give some more examples what the other list commands and functions will look like. What would for example be the syntax to add or read items from a list? (just out of curiosity) |
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Fri Dec 17, 2004 8:47 am Post subject: |
|
|
I'm not planning on any changes to the list commands and functions. I'm just proposing a method that lets the system allocate the list identifier instead of you having to pick a number and hope that it's not one you are already using. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Dec 17, 2004 9:52 am Post subject: |
|
|
Julian, how about something like this?
Code: | # Normal way of doing lists
list create,1
list add,1,My first list!
# A new way, which can "live" besides the old one
# First, get an empty list identifier into a variable
%%ListID = @empty(list)
# Now use this identifier with the list commands and functions...
list create,%%ListID
list add,%%ListID,Hello world! |
That way, people can still list identifiers themselves, while people who make includable (DSU) functions, can get a list identifier at random? By using this method, all old scripts will still work AND it will expand the features of VDS for people who make functions... _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Fri Dec 17, 2004 11:34 am Post subject: |
|
|
That's what I've done (except the function is called @new() ) because it isn't necessary to change the way lists etc. are handled to implement the new function.
However, if I were to change the implementation so that lists etc. are created dynamically, only when required, then I would have to remove the old way of doing things, or else change it so the list number was like a name rather than a pointer, which would require the runtime to search through a list of lists each time one was accessed, which would be less efficient.
So currently the @new() function will be available as an option, but the old method will still work, but we are stuck with hard coded limits on the number of lists, files and so on because it wastes memory to create arbitrarily large numbers of these things just for the few programs that actually need them.
Your point about DSUs is a good one that I hadn't thought of. Really, the @new() method is the only way to resolve that issue, because the system will never allocate a number that is already being used by the program. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
|