I think I am having beginners doubts about the use statement… In Python, Java, etc. the import statement imports a namespace and so there are no name conflicts.
import sys
and you have to say sys.exit, sys.argv.
There is
from sys import exit, argv
which amends the local namespace, but it is done under control. Anyone
using statements like:
from sys import *
is likely to be shunned from society. The same is true for star imports
in other languages exactly because ot pollutes the namespace.
D has an import statement:
import std.algorithm;
for example and it pollutes the namespace, exactly as star imports in
other languages. D programmers do this but it is awful, and better is:
import std.algorithm: filter;
so as to retain control of symbols in the namespace.
Currently I believe the Chapel use statement is like a D import without
selection and star imports in Python etc. i.e. the use statement
pollutes the namespace.
This would seem to indicate that use statements are a bad idea and that
explicit access such as:
Sort.sort(…);
avoiding the:
use Sort;
is a good idea. Or, most likely, I am just missing something…
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected]
41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected]
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------------
_______________________________________________ Chapel-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-users
