[Qbs] Language Proposal: A generic `Item{}` for classifying bindable objects.

Иван Комиссаров abbapoh at gmail.com
Sun Sep 4 16:22:39 CEST 2022


This seems like a nice idea, I was wondering the same thing myself if can we enforce the “schema” on object properties.

Иван Комиссаров

> 2 сент. 2022 г., в 05:14, hug-animals via Qbs <qbs at qt-project.org> написал(а):
> 
> 
> Greetings. I've been using QBS for quite awhile and have been expanding its use to do things other than build c++ projects. I have run up onto a limitting factor, and so I would like to make a language proposal to fix this.
> 
> Proposal: 
> Generic `Item` for classifying bindable properties.
> 
> What does this look like?
> 
> Product {
>     /* Syntax 1 */
>     property var feed: Item {
>         property string hobo
>         property var seed: Item {
>             property string chuck 
>         }
>     }
>     
>     /* Syntax 2 */
>     Item {
>         id: feed // unique ID to Product
>         property string hobo
>         Item {
>             id: seed
>             property string chuck 
>         }
>     }
> 
>     /* Syntax 3 */
>     Item {
>         name: "feed" // unique name to Product
>         property string hobo
>         Item {
>             id: seed
>             property string chuck 
>         }
>     }
> }
> 
> 
> /* In use */
> import "Sneed.qbs" as Sneed
> 
> Sneed {
>     feed.hobo      : "Hobo"
>     feed.seed.chuck: "Chuck"
> }
> 
> 
> What do you mean, "Classifying"?
> Sub Properties, stemming from a singular name, like `feed.hobo:` -- `feed` becomes the class, `hobo` becomes the property.
> 
> Why not use modules to do this?
> Modules can only exist in certain elements. `Item` should exist for every module. [Unless specifically blacklisted]
> 
> Is this important?
> Yes, insofar as it reduces namespace pollution in a practical way that is currently impossible.
> 
> What do you need this for? 
> In short, I am creating an expansive probe with hundreds of potential properties. Namespace pollution has become an issue, as well as encapsulation.
> 
> Why not name things `feed_seed_chuck:` instead of `feed.seed.chuck:`? 
> It may be the case, that I do not want to use anything from `feed` at all. It is much easier to check for `feed`s initialization than individually for `feed_seed_check` and `feed_hobo`.
> 
> Are you willing to program this?
> I have ~8 years experience as a Qt developer, and some time to throw at this.
> 
> Potential Drawbacks:
> - This does depart a bit from QML syntax rules.
> 
> What sort of feedback are you looking for?
> - Is there any inherent opposition on technical grounds?
> - What is the ideal syntax?
> - General thoughts.
> 
> Thank you for your time and consideration.
> 
> _______________________________________________
> Qbs mailing list
> Qbs at qt-project.org
> https://lists.qt-project.org/listinfo/qbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20220904/7058a229/attachment.htm>


More information about the Qbs mailing list