| View previous topic :: View next topic |
| Author |
Message |
gonzabar Newbie
Joined: 24 Jun 2001 Posts: 15 Location: Madrid, Spain
|
Posted: Wed Mar 17, 2004 10:40 am Post subject: VDS 5.01 versus 5.0 compiler (dsu) |
|
|
In the 5.0 version of VDS, when one compiles a source file (.dsc) to create a precompiled unit (.dsu), the compiler donīt check (I think) wether the functions/commands in that module, were previously defined or not (#DEFINE). But in the actual version, 5.01, the compiler sends an error message if (in a .dsu) a function/command is used without a previous #define. I think it was more flexible the way of older version (5.0) worked. The right choice would be, in my opinion, that this check ONLY take place to create an executable file (.exe) doing, in this case, a pre-process on the whole program looking for commands/functions definitions (see last paragraph in #INCLUDE help of VDS).
What is yout opinion about this ?. (Pardon for my bad english, I'm spanish-Madrid ) |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Wed Mar 17, 2004 11:38 am Post subject: |
|
|
Hi
I coud not understand your question completetly but even in VDS 5.01 as far as I know - you can compile a .dsu without defining any command or function but I guess it is a good habit to #define them in the dsu itself.
Also I just tested using a DSU without the function defined inside the DSU but in my .dsc file and it works well.
VDS 5.0 had a bug that prevented detection of #define placed on the first line of the dsu and some other wierd problems - this has been *mostly* fixed in vds 5.01 although U can still use first line as a comment "REM" to avoid any trouble.
I think VDS 5.01 forgives(?ignores) sometimes if a custom function is not #defined - but I think #define is there to speed up execution of the compiled scripts and also for syntax highlighting in the IDE. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
gonzabar Newbie
Joined: 24 Jun 2001 Posts: 15 Location: Madrid, Spain
|
Posted: Wed Mar 17, 2004 11:49 am Post subject: |
|
|
Example:
#define function,function_1
:function_1
...........
...........
...........
%e = @function_2(%1)
...........
...........
exit %e
If you compile it with VDS 5.01 to create a .dsu file, the compiler ends with an error (function_2 not defined).
If you compile with VDS 5.0, work OK
Thanks for your reply |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Wed Mar 17, 2004 1:49 pm Post subject: |
|
|
I think it's actually a bug that the compiler doesn't detect undefined functions. It's supposed to, and I'm annoyed that it didn't get fixed, because I'd much rather have the compiler tell me about undefined commands and functions than run-time errors when they are executed at run time. The main reason for this checking by the compiler is to avoid many of these errors that are caused by typos or plain old mistakes. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
gonzabar Newbie
Joined: 24 Jun 2001 Posts: 15 Location: Madrid, Spain
|
Posted: Wed Mar 17, 2004 8:58 pm Post subject: |
|
|
Thank you Jules for your reply but i cannot fully understand it (maybe is because of my poor knowledge of the english language). What version do you regard as being the one that works correctly, 5.0 or 5.01 ?.
As i said in my initial question, if i pretend to create an executable file (.exe), the checking MUST take place (i rather have a compilaton error than a run-time error) but if what i wish is to create a precompiled unit (.dsu) it is preferable that this checking does not take place (the definition of the functions will be investigated later on, when one creates the executable, during the compilation's pre-process). |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Mar 18, 2004 3:11 am Post subject: |
|
|
Hi gonzabar
I think you are talking about allowing a dsu to be compiled while it contains function calls that neither exist nor are defined (thus point to space at that moment). While I have never done such a thing with dsu's - I think the behaviour of VDS 5.01 complaining about invalid function is a "feature" rather than a bug as the VDS IDE has no means of knowing your intentions - using it with another dsu or a script that contains the function as well as it's #DEFINE ition. Instead it may well be that you have done a typo in your call for function name and then you distribute your DSU as a standalone (more common situation) and when the end user uses this DSU it will collapse with a runtime error when the function is called as it simply doesn't exist. And if this function is called only once a while U can imagine the consequence (a buggy app reaches end user).
I think VDS IDE having ability of compiling "true" projects - that is if a external file does contain the function (and the dependency is resolved) then compile the project as a whole (multiple linked DSU's for example or exes) - but then I think this may be too much work for VDS developer and also for a scripting langauge.
Alterntively you can make a feature request to have a checkbox in IDE to decide if the given DSU is standalone or dependent on other DSU's (in which case the older behaviour can be supported) - but then again this may confuse a newbie
Lastly simplest if U R the only developer of that app and/or don't mind others viewing the source you can use .dsc files as include - I think that should solve Ur problem. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
|