Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It looks like it could be made leaner.

This:

    name* = TextInput(
        | question = What is your name?
        | description = 
          Let's get started with the survey. First, please tell
          us your full legal name according to your passport.
    )
Could be just this:

    name* = TextInput
        # What is your name?
        Let's get started with the survey. First, please tell
        us your full legal name according to your passport.


But then how would you support choices or conditions for example?


Maybe something like this for choices?

    fruits = MultiChoiceInput
        # What are your favourite fruits?
        - [ ] Apples
        - [ ] Oranges
        - [ ] Bananas
Personally I'd prefer good old MDX though:

    <MultiChoiceInput
        name="fruits"
        hideIf={name.value !== "FruitLover"}
        options={["Apples", "Oranges", "Bananas]}
    />


Well, you can define the syntax however you like in a new DSL, right?

I like the syntax notpushkin proposed and would extend it a bit like this:

    fruits* = MultiChoiceInput
        # Pick two out of three fruits
        Fruits are healthy, so let's pick two fruits
        you will eat every morning for the coming week
        - [ ] Apple
        - [ ] Orange
        - [ ] Banana


All such text markup DSLs were invented at least once on usenet.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: