Eirik Berg Hanssen wrote:
Moritz Lenz <mor...@faui2k3.org> writes:
In all other cases of quote like constructs are the semantics are
explicit first (think of Q, qx, m, <, «), the delimiter comes later.
Changing that all of a sudden seems very unintuitive and wrong.
Thing is, comments are not quote-like. All of the quote-like
constructs are expressions. Comments are not.
Different things should be different, and comments should not look
like expressions. Or so it seems to me, at least.
On the contrary, I think that comments *are* expressions, *iff* they are
preserved in the meta-data for code that you can access when introspecting the
code, such as preserving documentation in the code meta-data, which it
I cite as prior art, for example, the FoxPro language, where the data-structure
representation of code has fields to store comments, such as to further explain
to people just looking at the code in the form of said data-structure what the
Muldis D does this too, since homoiconic is a core nature and the data-structure
version of code is just as valid as the string form that people normally write.
So I propose, and the details could still be worked out, that whenever a comment
appears in Perl 6 code, then depending on its relative location, then at parse
time it is attached as a meta-data field to the most contextually relevant code
structure, such as for whatever Perl statement it is next to, or routine it is
inside of, etc.
Mind you, this may overlap with desired uses of embedded pod, in Perl 6, but
either way, the fact a programmer wrote a comment for some code implies that the
comment is important, and as Perl code is transformed or alternately regenerated
later such as Perl 6 code for debugging, or for translating to/from some other
language, its nice to persist the comments through the process.
P.S. My proposal also implies that a Comment would need a data type if it is
retained in the meta-data. I propose naming the type "Comment", which is
essentially a "Str" but with minor differences if or insomuch perhaps as a
symbol/identifier is a "Str". Or it could be less like a Str in the whole but
it would at least contain a Str as an attribute.
-- Darren Duncan