During fixes for https://github.com/tim-janik/beast/issues/32 
https://github.com/tim-janik/beast/issues/24 you introduced manual null pointer 
checks for `as<TrackIfaceP>` and so on. I don't believe that this is the best 
approach; so I here is a suggestion of how I think it should be done.

I would recommend replacing each invocation of `as<>` with `bse_cast<>`, even 
if in some cases this will be a little longer:
```
casting track object
old: track ? track->as<TrackIfaceP>() : NULL;
new: bse_cast<TrackIfaceP> (track);

casting this object
old: as<TrackIfaceP>();
new: bse_cast<TrackIfaceP> (this);
```
However, I still think my version is the better API, because
- you cannot forget the null pointer check by accident
- it is a little more intuitive to see that we're just casting here

Its a bit of work to do the details and replace all cases where this is used, 
but if you want to go this way, I can provide a complete patch which eliminates 
as<>() completely.
You can view, comment on, or merge this pull request online at:

  https://github.com/tim-janik/beast/pull/34

-- Commit Summary --

  * BSE: bse_cast - an API suggestion of how to handle bse object casts

-- File Changes --

    M bse/bseobject.hh (10)
    M bse/bsesong.cc (4)
    M bse/bsetrack.cc (2)

-- Patch Links --

https://github.com/tim-janik/beast/pull/34.patch
https://github.com/tim-janik/beast/pull/34.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/tim-janik/beast/pull/34
_______________________________________________
beast mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/beast

Reply via email to