zenoh icon indicating copy to clipboard operation
zenoh copied to clipboard

export popular classes from `prelude`

Open milyin opened this issue 1 year ago • 2 comments

Describe the release item

Current prelude contains traits only and ZError and ZResult. There was a discussion (https://github.com/eclipse-zenoh/zenoh/pull/1007) do we need to export at least the most actively used structures from prelude also. This could be at least structures with same names as corresponding subcrates to allow user to write

use prelude::*;
Session session;

instead of

use prelude::*;
session::Session;

Let's decide, should we extend the prelude this way or not. @Mallets , @wyfo ?

milyin avatar Jun 14 '24 12:06 milyin

use prelude::*;
session::Session;

is not possible with the current prelude. Prelude only contains traits (and ZResult/ZError). The decision after #1007 discussion was to not include common english types in prelude (like Session), keep it only for traits. So no,Session should never go into the prelude again (unless you reexport it as ZSession maybe ...) The other part of the decision was to reexport a few types in the root, mostly Error, Result, Session and Config for the moment. So, without import, users are already able to write zenoh::Session, and they can still import it directly, as they do for almost every types of the stdlib/of their dependencies.

TLDR; the decision was already taken after #1007 discussions, I think you can close the issue.

wyfo avatar Jun 14 '24 13:06 wyfo

For the time being I'd say to keep it as it is. We are always in time to add more types in the future. At the moment the coverage of most actively used structures is unclear.

Mallets avatar Jun 14 '24 13:06 Mallets

Closed by https://github.com/eclipse-zenoh/zenoh/pull/1193

Mallets avatar Jul 04 '24 07:07 Mallets