Syntax: numbers prefixed with # or not

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Syntax: numbers prefixed with # or not

Valentin Villenave-3
Greetings,

Alongside issue #5473, I’ve started investigating whether numbers
still require to be prefixed with #.
AFAICS, the only ones that still do are in markups and all markups
commands, but hardly anywhere else; which _could_ make LilyPond syntax
a tiny bit easier to grasp for new users…
Or we can still use # everywhere as a matter of principle, even though
it’s no longer a hard requirement. (Pro: less possible confusion with
durations and better consistency with markup commands; Con: it’s one
of those things experienced LilyPonders hardly notice anymore, but
that do make the entry code a tad more exotic-looking to newcomers.)

My proposal would be to add convert-ly rules for:
-any \override, \set or \tweak involving a number-defined property
(including integers, decimals and negative numbers).

-also handle properties defined at the context-creation level, i.e. in
\with or \layout blocks.

-any music functions with a number arg:
barNumberCheck
finger
harmonicByFret
harmonicByRatio
mark
ottava
rightHandFinger
shiftDurations
as well as phrasingSlurDashPattern, slurDashPattern and tieDashPattern
(and the new \dropNote etc. functions I recently added).
Now,this may be tricky as some of those have optional args,
number-or-markup args etc. Things like \ottava are quite
straightforward, though.

-Mainly use non-# numbers in the docs, that is: everywhere *except* in
NR1.8 Markup where we’d need to explain that markup commands require
numbers to be explicitely handled as Scheme tokens.

-To stay on the safe side, possibly leave user-defined music functions
unchanged for now. (Which includes some regtests like
input/regression/rest-ledger.ly and quite a bunch of LSR snippet.)

… Or, we just don’t bother and keep using (and recommending) # everywhere.
Thoughts?

Cheers,
V.

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Syntax: numbers prefixed with # or not

Kieren MacMillan
Hi Valentin,

> Or, we just don’t bother and keep using (and recommending) # everywhere.
> Thoughts?

I use # everywhere I can, even where it’s not strictly necessary, in part because it visibly sets arguments apart for easy parsing [by me].

Not sure if that’s useful input for you?

Best,
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Syntax: numbers prefixed with # or not

David Kastrup
In reply to this post by Valentin Villenave-3
Valentin Villenave <[hidden email]> writes:

> Greetings,
>
> Alongside issue #5473, I’ve started investigating whether numbers
> still require to be prefixed with #.

In music, something like -.4 has entirely different meaning than in
layout blocks.  To wit:

baba = -.4
\void \displayScheme #baba

\layout {
  bubu = -.4
  \void \displayScheme #bubu
}

--
David Kastrup

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Syntax: numbers prefixed with # or not

Valentin Villenave-3
On 2/21/19, David Kastrup <[hidden email]> wrote:
> baba = -.4

Indeed. That’s probably rare enough that we could get away with a
@knownissues in the right place(s), though…

Right now, the new ability to have #-less numbers (and strings,
although my recent patch changes that) isn’t documented anywhere but
the git log. Do we want to keep it that way so as not to risk users
getting confused? Seems a bit unfair.

V.

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Syntax: numbers prefixed with # or not

Trevor Bača-2
In reply to this post by Kieren MacMillan
On Thu, Feb 21, 2019 at 7:44 AM Kieren MacMillan <
[hidden email]> wrote:

> Hi Valentin,
>
> > Or, we just don’t bother and keep using (and recommending) # everywhere.
> > Thoughts?
>
> I use # everywhere I can, even where it’s not strictly necessary, in part
> because it visibly sets arguments apart for easy parsing [by me].
>
> Not sure if that’s useful input for you?
>

Hi Kieren, Valentin,

I've shifted my practice the opposite direction of Kieren's, I suppose: I
omit # before numbers everywhere that it's possible to do so.

No real Lily rationale here, other than a personal coding practice to
employ the (lexically) shortest version of equivalent statements. I think
the original impulse came years ago when I was trying to rid myself of
redundant precedence indicators, eg, to use "a + b * c" everywhere in place
of "a + (b * c)"; because the two forms are equivalent (in most languages),
I wanted a canonical version for myself that I could spot at a glance. That
practice leaked into my Lily code, with the slight preference now for "99"
to "#99" where the forms are equivalent.

Trevor.

--
Trevor Bača
www.trevorbaca.com
soundcloud.com/trevorbaca
_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel