7.28: adda/function/ways of referring to non-locals:
[8.8: intro:
. when namespaces are nested
such as when a program contains subprograms,
the usual situation is called shadowing
which means, for example, that if
subsub is within sub is within main,
and they each declare a symbol, x;
then each scope sees only its own x .
. if subsub wanted to see main's x,
it might specify a pathname;
eg, global/main/x .
. we might also require this for all globals
just to make it easy on the reader;
because if symbol y were not defined in subsub
yet subsub was using it,
then we have to look in every superscope,
(sub, and main, in this example).
whereas, if we require pathnames for globals,
then the reader instantly knows the meaning of
global/main/sub/y .]
. instead of refering to a scope's ancestors
to reach globals,
we could use "(global) treated as root of fs
to reach non-locals .
. "(parent) is useful as a namespace root,
but if you're going to have a parent.keyword,
users will expect a grandparent as well
(gparent, ggparent, gggparent, etc) [8.8:
so that instead of writing global/main/sub/y
it can be compacted to gparent/y .]
...
. of ways to identify globals,
it was suggested that we could recognize
such roots as {global, parent, gparent, etc};
but in our case,
the global namespace will be static
(no symbols are added after compile time);
so that gives us an advantage
that will make it easier on the writers:
all they need to do is find
some unique subset of the url,
and then we can identify the full url
by doing a bottom-up search
comparing the leaf first . [8.8:
... however, chances are,
that is hardly reader-friendly;
if the name seems long, and it's used much,
then use renaming: ( x: gparent/x; ); 8.9:
nevertheless, we can have the compiler
use this system for helping both readers and writers,
by letting writers abbreviate, and then
expanding abbreviations to help readers .]
Showing posts with label naming. Show all posts
Showing posts with label naming. Show all posts
2012-08-26
2012-08-23
nested subprogram pathnaming
7.17: adda/syntax/nested namespaces of various impl's:
. what is the path delimiter for nested name spaces,
main/sub or
main.sub?
. notice if a file system were
pre-declared and const,
then pointers are not needed;
so, the path is x.y.z not x/y/z .
8.22:
. nested subprograms need not be const's;
they can be redefined at any time
without having to recompile the superprogram;
but the question is moot; because,
. what is the path delimiter for nested name spaces,
main/sub or
main.sub?
. notice if a file system were
pre-declared and const,
then pointers are not needed;
so, the path is x.y.z not x/y/z .
8.22:
. nested subprograms need not be const's;
they can be redefined at any time
without having to recompile the superprogram;
but the question is moot; because,
folder naming like internet subdomains
7.12: adda/dstr/folder naming like internet subdomains:
. in the naming system for subsystems,
the naming of a folder can have a special meaning
because the folder represents
something like a website;
so, just as the top domains
(.com, .org, .net ...)
indicate a website's role type,
these folder types ( .pkg, .type )
can indicate top level domains in our
network of modules .
[8.21:
. later that system would change so that
(.pkg) was the implicit datatype
of any untyped folder
if it was within adda's path .]
. a module can be divided into several folders
by using subdomains; eg,
given these top-level modules:
( int.num.type
, real.num.type )
we can see that both int and real
belong to the same datatype, num;
so, when importing num.type
we're reaching all the folders named *.num.type .
8.8: on the other hand:
. in the naming system for subsystems,
the naming of a folder can have a special meaning
because the folder represents
something like a website;
so, just as the top domains
(.com, .org, .net ...)
indicate a website's role type,
these folder types ( .pkg, .type )
can indicate top level domains in our
network of modules .
[8.21:
. later that system would change so that
(.pkg) was the implicit datatype
of any untyped folder
if it was within adda's path .]
. a module can be divided into several folders
by using subdomains; eg,
given these top-level modules:
( int.num.type
, real.num.type )
we can see that both int and real
belong to the same datatype, num;
so, when importing num.type
we're reaching all the folders named *.num.type .
8.8: on the other hand:
2010-07-27
naming syntax struggles
7.18: sci.adda/type naming confused with file names:
. if type names and file paths
can be used in the same places,
then the type name"(/.T) (ptr to type"T)
could be confused with
a root folder containing
a file having a null name and ext"type .
7.21: adda/url syntax:
. my revised url syntax differed by
using dos drive letters as domain names,
C:\ was //C.drive/
and anything in the .drive domain
was a subdomain of .local;
eg, //mypc.local/E.drive
is a typical dos volume .
. while dos does auto-assign
labels to drives,
the software on dos can also
assign labels to a
subfolder on a drive .
. since std url's use the "file " protocol
to mean a local space,
could file be the name for {drives, subdir's}?
eg, //c.file/ ?
no:
file is an obvious protocol only within
the syntax of file:// .
. if you change the syntax or omit it,
the meaning naturally reverts to std english:
eg, c.file is a file!
. even if a label is pointing to a subdir,
app's still think it's a drive,
so stick with the use of .drive .
. whether unix or dos,
the machine can be reached by .local;
if dos and a drive is not specified
then c.drive is assumed to be root .
web.adda/golang/case-for-visibility rule:
7.17:
. an exported identifier must
begin with an upper-case letter .
7.25: web: case-for-visibility advantages
> In my brain:
Date: Sat, 9 Jan 2010:
. if type names and file paths
can be used in the same places,
then the type name"(/.T) (ptr to type"T)
could be confused with
a root folder containing
a file having a null name and ext"type .
7.21: adda/url syntax:
. my revised url syntax differed by
using dos drive letters as domain names,
C:\ was //C.drive/
and anything in the .drive domain
was a subdomain of .local;
eg, //mypc.local/E.drive
is a typical dos volume .
. while dos does auto-assign
labels to drives,
the software on dos can also
assign labels to a
subfolder on a drive .
. since std url's use the "file " protocol
to mean a local space,
could file be the name for {drives, subdir's}?
eg, //c.file/ ?
no:
file is an obvious protocol only within
the syntax of file:// .
. if you change the syntax or omit it,
the meaning naturally reverts to std english:
eg, c.file is a file!
. even if a label is pointing to a subdir,
app's still think it's a drive,
so stick with the use of .drive .
. whether unix or dos,
the machine can be reached by .local;
if dos and a drive is not specified
then c.drive is assumed to be root .
web.adda/golang/case-for-visibility rule:
7.17:
. an exported identifier must
begin with an upper-case letter .
7.25: web: case-for-visibility advantages
> In my brain:
> - lower case = Common, normal things. Normal words."Rob 'Commander' Pike"
> - Upper Case = Unique, special things. Name of unique thing.
> - ALL UPPERCASE = Things need special care, a kind of warning.
. in English, capital words are "proper nouns".
They're important, public things
like names and places.
The analogy with
public and private names inside a package
is a bit of a stretch
but does make sense.
Public things are more important,
and so they're capital.
The ability to
glance at a name in a package
and know, without finding its declaration
(or some keyword somewhere near the declaration)
that it is a publicly visible name,
is a great thing
that more than makes up for
the inability to use some of the styles you mention.
Subscribe to:
Posts (Atom)