1. class X::Assignment::RO { ... }
  2. my class Nil is Cool { # declared in BOOTSTRAP
  3. method new(*@ --> Nil) { }
  4. multi method gist(Nil:) { 'Nil' }
  5. method Numeric() { warn "Use of {self.gist} in numeric context"; 0 }
  6. method Str() { warn "Use of {self.gist} in string context"; '' }
  7. method sink(*@ --> Nil) { } # required by RESTRICTED setting
  8. method AT-POS(*@ --> Nil) { }
  9. method AT-KEY(*@ --> Nil) { }
  10. # method ACCEPTS(*@ --> Nil) { } # XXX spec says Nil, but makes spectest hang
  11. method BIND-POS(*@) { die "Attempted to BIND-POS to {self.gist}." }
  12. method BIND-KEY(*@) { Failure.new(X::Bind.new(target => self.gist)) }
  13. method ASSIGN-POS(*@) { die "Attempted to ASSIGN-POS to {self.gist}." }
  14. method ASSIGN-KEY(*@) { die "Attempted to ASSIGN-KEY to {self.gist}." }
  15. method STORE(*@) { X::Assignment::RO.new(:typename<Nil>).throw }
  16. method push(*@) is nodal { die "Attempted to push to {self.gist}." }
  17. method append(*@) is nodal { die "Attempted to append to {self.gist}." }
  18. method unshift(*@) is nodal { die "Attempted to unshift to {self.gist}." }
  19. method prepend(*@) is nodal { die "Attempted to prepend to {self.gist}." }
  20. method FALLBACK(*@ --> Nil) { }
  21. # These suggest using Nil.new if they fall through, which is LTA
  22. method ords() { self.Str.ords }
  23. method chrs() { self.Int.chrs }
  24. method chop() { self.Str.chop }
  25. method chomp() { self.Str.chomp }
  26. method iterator() { self.list.iterator }
  27. }