Kasper,
I wouldn't say your suggestion looks any more readable than the many
parentheses of the original expression. The whole operation is complex
enough to be hard to understand.
So I agree with both Richard and Sebastian - you should either make the
steps readable by giving the intermediate results good names or factor
the whole operation out into some object and good method name (which
would be hard to read in itself without the temp vars, so you should
pobably combine both suggestions).
My opinion may be irrelevant, as I don't hold a "real" CS degree. I look
at this from the perspective of the poor guy who has to debug this in
three years rather than from an angle of elegance or conciseness.
I guess even something like the .then() - syntax from Javascrpt wouldn't
make this any more readable. And whatever symbol you'd chose it wouldn't
communicate what's happening...
Joachim
Am 26.01.22 um 10:19 schrieb Kasper Osterbye:
Cheers all
I have noticed that I often ends up with quite a number of nested expressions,
for example:
(((json at: 'tree')
select: [ :e | (e at: 'type') = ‘blob' ])
collect: [:e | Path from: (e at: 'path')])
select: [ :p | p segments last
in: [ :name | (name endsWith: '.md') | (name
endsWith: '.mic') ] ]
What kind of proposals (if any) have been for a different syntax which could
give a more streamlined syntax?
My own thinking has been around an alternative to the cascade semicolon. What
symbol to use does not matter for me, but something like
json at: ‘tree' º
select: [ :e | ((e at: 'type') = 'blob’)]º
collect: [:e | Path from: (e at: 'path’)]º
select: [ :p | p segments last
in: [ :name | (name endsWith: '.md') | (name endsWith: '.mic')
] ]
Basically, a send the right hand expression to the result of the left hand
expression.
Has anyone ever tried this, or is it just one of the many small annoyances best
left alone?
Best,
Kasper
--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel mailto:jtuc...@objektfabrik.de
Fliederweg 1 http://www.objektfabrik.de
D-71640 Ludwigsburg http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1