Re: Scheme pattern for retrieving data in objects

2022-04-03 Thread Jonas Hahnfeld via Discussions on LilyPond development
To add my 2 cents here, bearing in mind that I mostly care about LilyPond's Scheme code instead of user code in scores: On Sat, 2022-04-02 at 13:38 +0200, Han-Wen Nienhuys wrote: > On Fri, Apr 1, 2022 at 6:43 PM Jean Abou Samra wrote: > > [...] > > > > Does anyone find a value in defining a

Re: Scheme pattern for retrieving data in objects

2022-04-03 Thread Jean Abou Samra
Le 02/04/2022 à 13:38, Han-Wen Nienhuys a écrit : It's shorter, but is it easier to understand and discover? Is the former code (which is somewhat verbose) a real barrier to getting coding/typesetting done? Over the years, I've become extremely wary of syntactic sugar: it adds an extra barrier

Re: Scheme pattern for retrieving data in objects

2022-04-02 Thread Luca Fascione
I can see this happening, I thought a bit about it and it seems to me there are several factors that are potentially at play here: - one is how much alignment there is between the API presented to (or rather, *perceived* by) the user vs their mental model of what is going on in the program: the

Re: Scheme pattern for retrieving data in objects

2022-04-02 Thread David Kastrup
Kieren MacMillan writes: > Hi Han-Wen, > >> Over the years, I've become extremely wary of syntactic sugar: it adds >> an extra barrier to usage/development because everyone not only has to >> learn Scheme, they also have to learn the (lilypond specific) idioms >> involved. > > I'm curious you

Re: Scheme pattern for retrieving data in objects

2022-04-02 Thread Kieren MacMillan
Hi Werner, > your experience is not unique. I think that developers and normal users > (but probably not Scheme wizards) have rather diametral views on this topic. Excellent point. — Kieren

Re: Scheme pattern for retrieving data in objects

2022-04-02 Thread Dan Eble
> On Apr 2, 2022, at 07:38, Han-Wen Nienhuys wrote: > > On Fri, Apr 1, 2022 at 6:43 PM Jean Abou Samra > wrote: ... >> (fetch left-bound-info assoc-ref (common-Y X padding attach-dir) I'm not enthusiastic about multiple variable declarations in one line or

Re: Scheme pattern for retrieving data in objects

2022-04-02 Thread Werner LEMBERG
>> Over the years, I've become extremely wary of syntactic sugar: it >> adds an extra barrier to usage/development because everyone not >> only has to learn Scheme, they also have to learn the (lilypond >> specific) idioms involved. > > I'm curious you say that, since my experience is precisely

Re: Scheme pattern for retrieving data in objects

2022-04-02 Thread Kieren MacMillan
Hi Han-Wen, > Over the years, I've become extremely wary of syntactic sugar: it adds > an extra barrier to usage/development because everyone not only has to > learn Scheme, they also have to learn the (lilypond specific) idioms > involved. I'm curious you say that, since my experience is

Re: Scheme pattern for retrieving data in objects

2022-04-02 Thread Han-Wen Nienhuys
On Fri, Apr 1, 2022 at 6:43 PM Jean Abou Samra wrote: > > Folks, > > Just a random thought in passing: I just wrote something of this kind > once again: > > (let ((elements (ly:music-property m 'elements)) >(element (ly:music-property m 'element)) >(articulations

Re: Scheme pattern for retrieving data in objects

2022-04-01 Thread Jean Abou Samra
Le 01/04/2022 à 18:43, Jean Abou Samra a écrit : \version "2.23.8" #(define-syntax-rule (fetch obj getter (sym ...) body body* ...)    (let ((evald-obj obj) (evald-getter getter)) (let ((sym (getter obj 'sym))    ...)    body body* ...))) {   c'1   \tweak

Scheme pattern for retrieving data in objects

2022-04-01 Thread Jean Abou Samra
Folks, Just a random thought in passing: I just wrote something of this kind once again: (let ((elements (ly:music-property m 'elements))   (element (ly:music-property m 'element))   (articulations (ly:music-property m 'articulations)))   ...) (let ((padding (assoc-ref details