[QBS] syntactic sugar

Oswald Buddenhagen oswald.buddenhagen at nokia.com
Tue Feb 28 11:28:57 CET 2012


On Tue, Feb 28, 2012 at 08:40:54AM +0000, ext joerg.bornemann at nokia.com wrote:
> Without any changes to the parser we could just use a property binding.
> 
> Product {
>     name: "foo"
>     depends: ["cpp", "egon", "olsen"]
> }
> 
we could do that. but i don't like the idea of having *yet more*
syntaxes for depends.

> Already simpler. You propose this
> 
> Product {
>     name: "foo"
>     depends: "cpp"
>     depends: "moo"
> }
> 
> You cannot have more than one binding unless we clearly define what it means.
> 
i'm strictly against this. consistency in the language and its semantics
is important.

> > - the same for this construct:
> >     Group {
> >       condition: qbs.target == "windows"
> >       files: [
> >         "harddiskdeleter_win.cpp",
> >         "blowupmonitor_win.cpp",
> >         "setkeyboardonfire_win.cpp"
> >       ]
> >     }
> >    why not simply write:
> >     Group (condition: qbs.target == "windows") {
> >       files: [
> >         "harddiskdeleter_win.cpp",
> >         "blowupmonitor_win.cpp",
> >         "setkeyboardonfire_win.cpp"
> >       ]
> >     }
> 
> I cannot see why this is simpler. You're adding two more characters after all. ;-)
> 
he certainly meant to remove the "condition: " part, riiiiight? ;)
you may remember that we discussed this before. if we do it that way,
we can rename Group to If and introduce an Else node to simplify writing
alternative branches.
there are severals problems with that, though:
- while it isn't, this very much looks like imperative programming
- we impose more rules on the structure of the files
- we get a symmetry problem with other conditional nodes, e.g.,
  Properties. so make that IfGroup, ElseGroup, ElifGroup and
  IfProperties, ... instead? it gets ugly.
- it's yet farther away from "normal" qml




More information about the Qbs mailing list