2013-02-28

relative url syntax

1.20: adda/syntax/relative url/
up.arrow is confused with power operator:
. thinking again about the unix filename syntax;
the point of that is one is primarly
passing the filename to a shell
which is a program primarily used for executing files .
. the unix expectation is that
executables are not scattered;
rather, they are in particular folders
with special read-only and exe'able permissions .
. then there is a path variable,
where you can list all the exe'able folders .
. since the current directory is not the default path,
unix needs a special symbol for the current directory
and any system would need a special symbol
for going to the parent directory,
unless using a rule like traverse up ancestors,
stopping at the first one that contains the indicated file
(that idea is only safe in library filesystems
in contrast to working folder systems).

. it seems more intuitive to use (^^/)
instead of (../../),
however, if the nesting gets deeper than 5,
(^^^^^/) starts to get less readable
than (../../../../../);
on the other hand,
deeply nested relative addressing
is not used much by humans;
whereas machines can read it
as easily as they can write it .
. also, it might be
easily confused with the power operator,
since it's being placed at the front of a term,
whereas the power operator is between terms .
. it would be intuitive that both cases
would use the operator in a similar way;
but a power operation has nothing to do with
directing a path upward .

adda/syntax/relative url/
relative to project root instead of self:

. the usual reason for using a relative url
is to allow a project folder to be relocatable;
that implies that all the project files
know which folder is their constant root folder .
. each file can have a root variable,
that indicates where the file thinks its root is;
eg, (root = 3) means go up 3 levels;
. then the file uses root as a pointer, eg:
root/sub/sub/file .
. in order to avoid a reserved variable,
root could be a datatype:
proj.root: 3 -- assigned to 3 levels up from here .
. then use proj/sub/sub/file
insead of root/sub/sub/file .

adda/syntax/relative url/alternatives to up.arrow:
. if a project folder system is rather deep,
having paths that are relative to project root
may not be as compact as relative to self .
. to support relative-to-self addressing,
we could use the term "up",
and then the power operator could be used:
up^3/sub/file
means go up 3 times,
then down to sub.folder, etc .
. in order to reduce the number of reserved words,
we should find an operator character to replace "up" .
. since (/) means (down) in this context,
we can intuit that (\) means (up).
. we can still use the power operator with that:
\^3/sub/file,
or we can use them in sequences:
\\\/sub/file .
. this syntax can also be useful in general graphing,
where the node has more than one incoming edge,
eg, in genetics trees,
there is a ma and pa back-step:
\ma\pa\/ = children of maternal grandfather .

No comments:

Post a Comment