in reply to perl6 custom operator problem

A few ideas:

Here's another version that accomplishes something similar:
enum Prefixes ( :pico(10.0 ** -12), :nano(10.0 ** -9), :micro(10.0 ** -6), :milli(10.0 ** -3), :centi(10.0 ** -2), :one(1.0), :hecto(10.0 ** 2), :kilo(10.0 ** 3), :mega(10.0 ** 9), :giga(10.0 ** 9), :tera(10.0 ** 12), ); enum MassAbbrevs ( :g(one), :kg(kilo) ); enum LengthAbbrevs ( :m(one), :km(kilo) ); class SI { } class Mass is SI { has $.v; } class Length is SI { has $.v; } multi postcircumfix:<[ ]>(Real $n, MassAbbrevs $abbrev ) { return Mass.new(v => $n * $abbrev); } multi postcircumfix:<[ ]>(Real $n, LengthAbbrevs $abbrev ) { return Length.new(v => $n * $abbrev); } multi infix:<+>( SI $x , SI $y where .isa($x) ) { $x.WHAT.new( v => $x.v + $y.v); } say 10[kg] + 1[g]; say 1[km] + 1[m];