You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think if we could use such generic type then the code would be more readable and maintainable. Also using such code should be safer as writing a nil deference panic would be harder. Moreover, if the average case is to pass the config model around a single call stack, non pointer is probably better performance-wise.
On the other hand using such generic would require more code if e.g. the user would like to log the config model value.
How we would using pointers is easier if one would like to e.g. not create a meter provider
cfg, err:=configyaml.Parse(file)
// err handlingcfg.Metrics=nil// do not create a meter providersdk, err:=config.NewSDK(cfg)
Usually the config would be created by parsing configuration files. We do not expect OTel users to create them by hand (the config model should easily created by the parser modules).
Closing as I also changed my mind regarding my proposal.
I find having pointers in domain models not clean.
From the usage perspective it often leads to creating helpers like
ptrInt
,ptrString
(related Go proposal golang/go#45624)We could use (and define) something like this instead of using pointers:
I think if we could use such generic type then the code would be more readable and maintainable. Also using such code should be safer as writing a nil deference panic would be harder. Moreover, if the average case is to pass the config model around a single call stack, non pointer is probably better performance-wise.
On the other hand using such generic would require more code if e.g. the user would like to log the config model value.
Based on discussion in #4228 (comment)
The text was updated successfully, but these errors were encountered: