#2414 Funcs in const classes

SlimerDude Thu 30 Apr 2015

Given that functions can be immutable, similar to Lists and Maps, I would have expected the following to work - but instead it gives a compile err:

const class Funcy {
    |->Buf|? bufFunc  // --> Compile Err!!!
}

Const type 'Funcy' cannot contain non-const field 'bufFunc'

Is this right? Or am I missing a concept somewhere?

brian Thu 30 Apr 2015

Just missing the const modifier on your field, fix that and it works:

const class Funcy {
  const |->Buf|? bufFunc  // --> Compile Err!!!
}

SlimerDude Fri 1 May 2015

D'Oh! Thanks Brian, I'm now feeling both relieved and very, very stoopid!

It was late last night...

Login or Signup to reply.