Stream: shorthand
Topic: shorthand for deeply indented /nested elements
Jose Costa Teixeira (Jul 08 2020 at 16:29):
Not sure this is covered elsewhere but the closest I've seen was Aliases:
Does it make sense to have some shorthand syntax for nested elements? At some point, especially when creating examples, it'd be shorter (and visually nicer I think) to have some way to express indented elements.
Chris Moesel (Jul 08 2020 at 19:53):
Funny you should ask. We were just discussing this today... It's one of the things we want to look at for SUSHI STU2. We're open to suggestions. So far, we've thought of:
- YAML-like syntax (but making FSH whitespace sensitive is a big change)
- Block syntax (e.g., using
{
}
or other delimiters to encapsulate child paths - Declarative contexts (e.g.,
CONTEXT a.b.c
would prefix following rules witha.b.c.
- Alias (e.g.,
* Alias: abc = a.b.c =
or* a.b.c alias abc
then* abc.d
.
We're open to suggestions!
Jose Costa Teixeira (Jul 08 2020 at 21:21):
I was only thinking of 2 ways:
- yaml-like
- something like * and
**
in markdown list item indenting: the second star means "this next statement starts on the first indentation of the previous statement" - and***
or****
meaning second or third indentations. this is somewhat limited... - (alias +) a special keyword - I'm recalling
with
statement in Pascal:
combining these ideas, instead of
* a.b.c.d = 1
* a.b.c.e = "string"
* a.b.c.f = #code
we'd have
* with a.b.c:
** d = 1
** e = "string"
** f = #code
or
* a.b.c as abc
* with abc:
** d = 1
** e = "string"
** f = #code
Jose Costa Teixeira (Jul 08 2020 at 21:23):
(sorry for the incidental odd syntax for aliasing, I don't know where it comes from, but that is not the focal point)
Lloyd McKenzie (Jul 08 2020 at 22:22):
I have to admit that "Go FSH" fills me with joy - whatever it is the app does :)
Chris Moesel (Jul 08 2020 at 22:23):
I like this one, @Jose Costa Teixeira :
* with a.b.c:
** d = 1
** e = "string"
** f = #code
definitely a contender!
Last updated: Apr 12 2022 at 19:14 UTC