On Tue, 10 Feb 2009 13:14:24 -0800, Walter Bright wrote: > The version statement is designed to be inflexible. It's designed to > encourage abstracting and modularizing version differences, rather than > encouraging line-by-line differences.
I understand and support this view. However, it creates a new problem; code duplication. Is it possible to provide some syntax or technique to avoid having to cut&paste /small/ runs of code lines. Larger sections of code can be separated into functions or modules, but it because problematic when dealing with small sections (a few lines) of code. The overheads of function calling can be an issue. > 5. Why can't one 'version out' syntax that is not recognized by the > compiler? > > The problem is that supporting this requires semantic analysis in order > to successfully lex and parse the source code. Breaking this will make > the lexing and parsing an order of magnitude harder for third party > tools to do. Agreed, this is a problem. How can it be solved? The problem is often found when supporting V1 and V2 code in the same source file. The string mixin trick is NOT, repeat NOT, a satisfactory solution. Duplicating (nearly all of a) source file is NOT, repeat NOT, a satisfatory solution. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell
