Giter VIP home page Giter VIP logo

Comments (5)

Drup avatar Drup commented on July 18, 2024

What I'm thinking for now :

  • For top level declarations [%%client ... ] [%%server ... ] and [%%shared ... ] instead of {client{ ... }} {server{ ... } and {shared{ ... }}.
    As added bonus, let%server = .... will work at the toplevel. Also, since the syntax is going to be slightly different than the one for expressions, it may help solve an ambiguity for beginners.
  • For client values, I propose ( ... )[@cval ty] instead of {ty{ ... }}. (or simply ( ... )[@cval]).
    Other form will also implicitly work, for exemple begin[@cval ty] ... end, which is nice.
  • For injections [%inj ...] instead of %x and %(...). It's a bit more verbose, unfortunatly. I asked @alainfrisch if it was possible to use ( ... )%inj, but it's not possible.
    We could use this occasion to differenciate between injections inside a cval and injections inside a client section. It would help solve #17.

@balat, @benozol, Did I forget anything ? @alainfrisch, do you have better suggestions ?

from eliom.

alainfrisch avatar alainfrisch commented on July 18, 2024

I don't have any experience with writing client/server mechanism in Ocsigen, so I cannot really comment.

In order to mark "sections" of code, you could also use extension nodes or attributes as delimiters. Instead of [%%client ...], you could do:

[%%client]
....
[%%both]

This could be more robust w.r.t. other syntactic tools, since it would make the content of the section appear in the normal stream of structure items, not nested under the extension node.

For injection: if this is syntactically a unary prefix operator, did you consider using an actual operator symbol (e.g. "!!" or "~~")?

from eliom.

Drup avatar Drup commented on July 18, 2024

I prefer to have explicit delimiters for sections. And I really like let%server, so we will need to have [%server ... ] anyway. I don't think it's going to be that much of an issue with other syntax extensions, since the code modification done by eliom is minimal. Maybe we can have both with another syntax, like [%%server_section] buh meh.

Indeed, we could use an operator, but the potential of breaking something else is extremely high, so I'm not very fond of it.

from eliom.

alainfrisch avatar alainfrisch commented on July 18, 2024

The operator could be (re)defined by the user, as is:

[%%ocsigen.injection "~~"]

This would give a way to resolve clashes locally.

from eliom.

Drup avatar Drup commented on July 18, 2024

That's an interesting solution. We could use ~% by default to have minimal modification with the current state, which is nice.

from eliom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.