mbeddr.core icon indicating copy to clipboard operation
mbeddr.core copied to clipboard

default values for init fields in components are not supported

Open aykutkilic opened this issue 13 years ago • 0 comments

For the component below:

exported component oscillator extends nothing { 
  init uint8 wave_index; 
  init double freq_mod_offset; 
  init double freq_mod_gain; 
  ...

I have to define all the init fields in the composition: instance oscillator osc1(freq_mod_gain = 1, freq_mod_offset = 0, wave_index = 0)

Instead having default values for these fields:

exported component oscillator extends nothing { 
  init uint8 wave_index = 0; 
  init double freq_mod_offset = 0; 
  init double freq_mod_gain = 1; 

And defining only the values we want to override: instance oscillator osc1(wave_index = 2)

would be much more convenient.

aykutkilic avatar Feb 08 '13 14:02 aykutkilic