This was motivated by my attempt to create a set of "combiner" classes, where each Combiner{N} had a method which returned a Combiner{N+1}.
[2..22#
class Combiner1[[#A1#]]([#v1: A1#]){
def ~>[B](b: B) = new Combiner2[[#A1#], B]([#v1#], b)
// plus a handful of actual methods
}
#
]
This won't compile because Combiner22#~> returns the non-existent Combiner23 class.
Rather than changing the loop to 2..21 and rewriting Combiner22 manually, you can now skip the ~> method for iteration 22 by wrapping it in [!22..# and #]:
[2..22#
class Combiner1[[#A1#]]([#v1: A1#]){
[!22..#def ~>[B](b: B) = new Combiner2[[#A1#], B]([#v1#], b)#]
// plus a handful of actual methods
}
#
]
Coincidentally, this can also be used to create comments in your templates
This was motivated by my attempt to create a set of "combiner" classes, where each
Combiner{N}
had a method which returned aCombiner{N+1}
.This won't compile because
Combiner22#~>
returns the non-existentCombiner23
class.Rather than changing the loop to
2..21
and rewritingCombiner22
manually, you can nowskip
the~>
method for iteration 22 by wrapping it in[!22..#
and#]
:Coincidentally, this can also be used to create comments in your templates