Re: [Gaea] Named optional attributes

Matias Capeletto <[email protected]>
Newsgroups gmane.comp.lib.boost.documentation
Message-ID <CAJiTyxwaZ767FtkVaFfUmEH2ET_o1xj_uYsknHpyTQO2CbmFYw@mail.gmail.com>
On Tue, Nov 1, 2011 at 6:15 AM, Joel de Guzman
<[email protected]> wrote:
> On 10/31/2011 8:16 PM, Joel de Guzman wrote:
>> I think this makes perfect sense. I'll see how I can incorporate
>> these.
>
> I've added optional arguments and tightened up the spec a bit
> especially on arguments, markups and lists and template
> identifiers. I also added scoping. Here's the latest
> (still informal) spec:
>
>  http://pastebin.com/CmQzHhym

One thing that I forget to add in my last mail was the possibility to
give a default value to the optional arguments. If not included, the
default value is nil '[]' so we can check for that to see if it was
defined.
The specs could easily be extended:

  [def [$ path ~width ~height] ... ]

  or

  [def [$ path [~width 100px] [~height 100px]] ... ]

I know it is only syntax sugar because you could get the same effect
checking for nil in the body but I think this will be a common
scenario that is good we support right away.

> I modified the optional argument proposal a bit using tilde '~'
> instead of dot '.' for named optional args. I want to use the
> '.' for scoping.

It looks good.

> The later part of the spec discusses namespaces and scopes.

Can you explain this a little bit more?

""
  You may import names from other scopes this way:

    [import [ns][foo][bar]]   [/ Import foo and bar from ns ]"
""

Is import defined like [def [import ns . symbols] ... ] ?
Visually, I do not like that the three symbols are in the same level.
Maybe is just aesthetics but I think I prefer something like

  [import ns.foo]
  [import ns.bar]

Regards
Matias
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.