hzhou/MyDef

cumulative page

Closed this issue · 3 comments

Is it possible to have "cumulative page" (e.g. page:: file1, similar to subcode:: code1 for "cumulative subcode" )? So instead of using subcode to append a file like

page: file1
   Line 1
   $call file1
subcode:: file1
   Line 2
subcode:: file1
   Line 3 

, we can directly use

page:: file1
   Line 1
page:: file1
   Line 2
page:: file1
   Line 3

.

hzhou commented

The workaround is:

page: file1
    $call file1_main
subcode:: file1_main
    Line 1
subcode:: file1_main
    Line 2

The code inside page is really a hack to make composing short programs more convenient. The formal syntax for page is

page: file1
    subcode: main
          Line 1
          ...

So a page hosts subcode, where the main subcode is the starting point. Subcodes really don't need concatenation since you can just define your subcodes at the global scope.

hzhou commented

I realize you already know the workaround. Anyway, the requested feature is easy to add. But I need to be convinced that it is necessary.

Cumulative page, I think, would be for files without structure (so no need for subcode), e.g. log file, TODO list. And as it has a workaround, you may close this issue if it will not be implemented.