How to incorporate computed property macros w/ glimmer components

Hi I am looking for an example of how

computed property macro’s fit into the glimmer component context

having trouble finding explicit documentation on how macro’s are used in this case

Any help would be appreciated. Thanks

If you mean all of the classic macros that we know and love from @ember/object/computed they are still there and function in much the same way, just using decorators instead, e.g.

  @mapBy('children', 'age') childAges;
  // instead of
  childAges: mapBy('children', 'age')

If you mean writing a custom macro I’ll preface this by saying I haven’t tried it yet but looking at the source of the current ones it seems like it’s basically the same code as before so I’d think it would be pretty easy/comparable if not exactly the same.

1 Like

Thanks for the documentation references

Hi @dknutsen , thanks, the documentation helps a lot. To use the macros written in classic syntax work with glimmer syntax, had to import and use get from '@ember/object'.

I have a doubt, any idea on whether macros will be deprecated in the future?

Also will get from '@ember/object' be deprecated in the future?

There was an RFC published just a couple weeks ago deprecating all of the computed macros. I’m not sure about get(…) but I wouldn’t be surprised if that gets deprecated as well.

1 Like

Thanks for the update @dknutsen, I can understand why they are deprecating it.