Page 1 of 1

Allow using module names with 'With' directive

Posted: Thu Sep 24, 2015 7:26 am
by Blue
It would be great to be able to make use of With/EndWith wirth module names.

example :

Code: Select all

DeclareModule Ferrari
    #moduleName = "Ferrari"
    Define units
EndDeclareModule

Module Ferrari
    units = FactoryOutput(12)
EndModule
..
..
With Ferrari
    Debug #moduleName
    Debug units
EndWith
..
..
The result would be, of course, the same we now have with the UseModule/UnuseModule construct.
But it would offer the advantage of a lighter, clearer style when coding just a few lines.

For longer coding sections, the UseModule/UnuseModule pair would remain available, and most likely preferable.

Re: Allow using module names with 'With' directive

Posted: Thu Sep 24, 2015 10:31 am
by c4s
Just for the reference: "With" Keyword for Modules... ;)


Edit:
By the way, using Use/UnuseModule isn't the same as naming conflicts can very likely occur when importing the whole module.

Re: Allow using module names with 'With' directive

Posted: Thu Sep 24, 2015 2:03 pm
by Blue
c4s wrote:Just for the reference: "With" Keyword for Modules... ;)
You caught me being too lazy to do even the most basic search before opening this topic. :oops:
I stand corrected.