Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
blob: 811fda341ddb007e837f5335d79a1a45e04e4ce3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
@c  This document is part of the TAME manual.
@c  Copyright (C) 2017 LoVullo Associates, Inc.
@c    Permission is granted to copy, distribute and/or modify this document
@c    under the terms of the GNU Free Documentation License, Version 1.3 or
@c    any later version published by the Free Software Foundation; with no
@c    Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
@c    A copy of the license is included in the section entitled ``GNU Free
@c    Documentation License''.

@node Project TODOs
@appendix Project TODOs
This project has far more TODOs than are listed here, but here are
  some higher-level goals for the future.
There are miscellaneous TODOs sprinkled throughout the code,
  but those are lower-level.


@section Linker
The linker should be one of the fastest parts of the system@mdash{
  }it should just do a topological sort,
    resolve symbols as necessary,
    and arrange code blocks.
Unfortunately,
  especially due to memory requirements of loading so many packages
    into memory (using Saxon),
  this has been a pain point.
Performance has improved drastically,
  but we can do better by gutting other parts of the system that were
    designed as kluges or now have better solutions that alleviates
    linker work.

@enumerate
  @item Limit recursion during stack processing.
        If you look at a stack trace on error,
          it can be hundreds of levels deep.
        Instead,
          use a trampoline-style approach and indicate that additional
          symbols need to be loaded,
            but don't do so immediately in a recursive manner.
        This may or may not improve the memory footprint@mdash{
          }hopefully Saxon will see that previously generated trees
            are no longer necessary and GC them.

  @item Remove concept of classifier vs. rating processes.
        This distinction was important in the past to work around
          pulling in too many dependencies,
            but there's not really much rationale for separate
              @code{classify} and @code{rate} methods now,
                and it'll get rid of a decent amount of work.
@end enumerate


@section Compiler
The compiler itself has cruft from over the years and most of the code
  exists from the design prior to object files and symbol tables.
There is plenty of room for optimization.

@enumerate
  @item Validate against an algebraic type system.
        Certain classes of bugs can be avoided entirely by stating that
          values must always be a vector of positive real numbers, for
          example.
        The compiler can determine the type of expressions by the
          symbols it references and by its child expressions.
        In situations that are not resolvable at compile-time,
          runtime checks via terminating classifications would do;
            an example being the sum of two unsigned integers being
            non-zero.
        In cases where types are simply too difficult to determine
          without significant compiler work,
            annotations can be used to declare expressions equivalent
            to certain mathematical concepts
              (e.g. ``this function is equivalent to rounding to the
                nearest integer'');
              this can also serve as an alternative to primitives in
                certain instances,
                  since native target language features could be used.

@end enumerate


@section Preprocessor
The preprocessor is primarily responsible for macro (template) expansion.

@enumerate
  @item Remove distinction between primitives and short-hand template
          expansion.
        Treat @emph{all} nodes as potential template expansions,
          and use the core library to mark certain templates as
          primitives.
        This will allow extending the language grammar naturally,
          and easily convert existing primitives to templates.@footnote{
            For example, @samp{lv:rate-each} is a good candidate for
              a template.
            Ideally, all XSLT-driven expansions should be converted
                into templates (the template system didn't exist back
                then).}
@end enumerate


@section Input/Return Map
@enumerate
  @item Generate normal packages and use templates rather than a
          specialized system;
            it has numerous kluges to work around inconsistencies with
              other parts of the system,
                and copies code from portions,
                particularly for preprocessing.
@end enumerate


@section Worksheet
@enumerate
  @item Implement a symbol table and treat worksheet packages as
          normal packages.
        As it stands today,
          symbols will not be retained by the linker if they are
          referenced by the worksheet because there is no symbol table;
            this puts the onus on the developer to manually place
              it in the return map,
                which is error-prone.
@end enumerate