Re: [css-grid][css-syntax] Usage of lone parentheses across CSS?

On Thu, Jun 26, 2014 at 12:06 PM, François REMY
<francois.remy.dev@outlook.com> wrote:
>> On Thu, Jun 26, 2014 at 2:22 AM, François REMY
>> <francois.remy.dev@outlook.com> wrote:
>> > Hi,
>> >
>> > I’ve been reviewing the CSS Grid specification yesterday, and I was left
>> > wondering whether using parentheses to denote line names was a very good
>> > idea.
>> >
>> > At first, I would like to start collecting more information about the
>> > reasons behind this choice, and the existing parenthesis usage in CSS, >
>> > so I
>> > wondered whether there is any other location in CSS where parentheses >
>> > are
>> > used in a non-functional way inside propery values. I couldn’t find one
>> > > but
>> > it’s also totally possible something escaped my attention. If so, I >
>> > would be
>> > happy to get some pointers.
>>
>> It's just a nameless function, because we didn't need the clutter of a
>> function name there.
>
> Ok, so it's kinda an accident.

Don't know what you mean by this.  This usage was intentional.

>> > Given the area templates is defined using strings (grid-template-areas:
>> > “area-1 area-2...”) and used as identifiers (grid-area: area-1), I’m
>> > wondering about the opportunity to do the same thing for named lines >
>> > (so,
>> > replacing ‘grid-template-rows: (line-name) size...;’ by >
>> > ‘grid-template-rows:
>> > “line-name” size...;’).
>>
>> I'd prefer not trying to change anything here unless there's a bad
>> problem with the current syntax, or the new syntax has some amazing
>> benefit.
>
>
> I understand. I'm just wondering whether or not we should save "(...)" for a
> yet-to-be-defined more iconical usage instead. Putting things between
> parentheses usually carry some grouping semantic that is not present here.

The grouping semantic is "these keywords are line names".  We could
have easily done "lines(foo bar baz)", and in fact considered that,
but eventually decided on just the lightweight unnamed function.

> An example of an usage of parentheses blocks I would find more useful would
> be a shorter "calc()" notation, because this is something (1) ubiquitious
> and (2) that transforms multiple tokens into one "semantic" token (aka it
> creates a semantic group).

That's called "a function" - it's a grouping construct that provides a
specialized meaning to a set of tokens.  While we could use the
nameless function for calc(), I'd rather reserve it for various
specialized uses like what we're doing with grid-lines.

> I don't intend we should implement this proposal
> specifically, but that we should maybe leave the door open to something in
> this kind if it doesn't come at a cost. My point is there's no need to use a
> parentheses block here, so we should probably refrain from using it if
> there's no precedent of such usage in CSS.
>
> It is not that I have a strong opinion on this, but since there's no current
> implementation of the spec, and since I think it could be more
> future-friendly to avoid using parentheses here, I wanted to see if it
> looked reasonable to others, too.

Gotta establish precedent somehow.

~TJ

Received on Thursday, 26 June 2014 19:51:24 UTC