Open lymslive opened 4 years ago
After write this sample, I suddenly think that we may express the concept of debug/test in wenyan-lang as 辟邪
. “辟邪剑法” is alias to “葵花宝典” in 《笑傲江湖》.
吾有一術。名之曰「辟邪剑法」。欲行是術。必先得一言。曰「侠客」。是術曰。
夫「侠客」,书之。
吾有一言,曰,“扫荡群魔”,书之。
是謂「辟邪剑法」之術也。
若为辟邪故,乃
恆為是
启缄,
名之曰「侠客」,
施「辟邪剑法」于「侠客」。
云云
也
缄曰
林远图
也可以考虑乱曰
Syntax Proposal for end marker of script file
Inspired Background
In the less well-know VimL language, there is
finish
statement to finish the current script, let compiler ignore anything after that to the really end of script file. In Perl language there is__END__
marker, and further more,__DATA__
marker has additional functionality beside end the script. The content lines after__DATA__
can be accessed by a special file handle<DATA>
in current script.The useful thing for
__END__
marker is putting larger documentation in the end of script file. And__DATA__
can be served to self-unit test that need to read from input, which normally from STDIN or external file, while with__DATA__
the test data goes together with test code and main script function.By the way, the self-test also common in python like
if __name__ == __main__
.I think these functionality is useful for self-test/doc for stdlib, or may more handy for user custom util lib scripts, since stdlib may worth more professional automatical unit-test tools.
Syntax Keyword Proposal
For
__END__
marker, I think of several characters:And since
__END__
marker is only optional appear once in a script file, it may acceptable to use a special punctuation, solely or after a keyword.For
__DATA__
marker, how about just缄曰
?For
if __name__ == __main__
, we may say开天辟地
?Assumption Example
Since the lines after
缄曰
is data, the newline is sensible, but the first newline after缄曰
may skip.Dependent
__END__
is easy, it will be another issue if we want to normalize the documentation after__END__
.While
__DATA__
is dependent the stdlib functionality for read input or file handle alike.