Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functoria: Quote Runtime_arg.call #1522

Merged
merged 1 commit into from
May 17, 2024
Merged

Conversation

Julow
Copy link
Contributor

@Julow Julow commented Apr 23, 2024

Fixes codes that use an arg call as an argument to a function:

code ~pos:__POS__ "f ~arg:%a"
  Runtime_arg.call my_arg

@samoht
Copy link
Member

samoht commented Apr 24, 2024

Thanks! Do you have a use-case for this? Devices are not supposed to call function (the initial goal was that only functoria would use this)

@Julow
Copy link
Contributor Author

Julow commented Apr 24, 2024

I found this problem when updating this to mirage 4.5: https://github.com/robur-coop/caldav/blob/main/mirage/config.ml#L91

Key.serialize_call prints something that can be on the RHS of a label argument (either parenthesized or an identifier) but Runtime_arg.call do not and I hoped to swap one for the other.

@samoht
Copy link
Member

samoht commented Apr 24, 2024

With the new API the argument name is passed as the last parameters of the call to connect. You can then just use it directly, you don't need to serialize it yourself.

We should probably remove that function from the public API to avoid people doing this :-)

@Julow
Copy link
Contributor Author

Julow commented Apr 24, 2024

This is indeed not needed in robur-coop/caldav#36, thanks!

Runtime_arg.call is still needed within mirage, so I think quoting doesn't hurt.

@hannesm hannesm mentioned this pull request May 16, 2024
14 tasks
@samoht
Copy link
Member

samoht commented May 17, 2024

Could you please rebase this PR? While I don't think the change is strictly necessary, it makes the generated code more robust so I'm fine with merging it.

Fixes codes that use an arg call as an argument to a function:

    code ~pos:__POS__ "f ~arg:%a"
      Runtime_arg.call my_arg
@hannesm
Copy link
Member

hannesm commented May 17, 2024

I took the liberty of rebasing. fine to merge when CI passed.

@hannesm hannesm merged commit 42f927a into mirage:main May 17, 2024
1 of 3 checks passed
hannesm added a commit to hannesm/opam-repository that referenced this pull request May 17, 2024
CHANGES:

- BREAKING: remove `~name` parameter from Mirage.Runtime_args.create
  (mirage/mirage#1541 @samoht, fixes mirage/mirage#1532)
- BREAKING: remove `~name` parameter from Mirage.runtime_arg, and use a
  string (instead of a format string) as third parameter (mirage/mirage#1541 @samoht)
- constrain the `start` function to `unit Lwt.t`. Previously, there was no
  restrictions, and lots of time was spent in debugging when a unikernel
  resulted in `unit Lwt.t Lwt.t` (@Julow mirage/mirage#1524)
- revise man page sections and ordering: ARGUMENTS, OPTIONAL, NETWORK OPTIONS,
  DISK OPTIONS, LOG AND MONITORING OPTIONS, OCAML RUNTIME OPTIONS. Previously,
  the ARGUMENTS and OPTIONS were put later, and were hard to find. These are
  the sections where unikernel-specific arguments are put by default
  (mirage/mirage#1531 @hannesm @reynir)
- add --net=host and --net=ocaml to reduce confusion. --net=host uses the
  TCP/IP socket stack, --net=ocaml the OCaml network stack (mirage/mirage#1525 @hannesm)
- quote Runtime_arg.call (mirage/mirage#1522 @Julow)
- documentation fixes (inline examples @Julow mirage/mirage#1523, @hannesm mirage/mirage#1537 (fixes
  mirage/mirage#1512 reported by @reynir), Runtime_args.create mirage/mirage#1541 @samoht)
- fix the build instructions of the generated opam file: since 4.5.0
  `mirage build` is no longer available, use `make "build"` (mirage/mirage#1527 @hannesm)
- add RELEASE.md, a guide on how to cut a mirage release (mirage/mirage#1519 @samoht)
- allow git 3.16 (mirage/mirage#1536 @hannesm)
- use mirage-bootvar (using dune variant) instead of parse-argv and
  mirage-bootvar-xen, mirage-bootvar-solo5, mirage-bootvar-unix
  (mirage/mirage#1533 @hannesm)
- BUGFIX: reset the lexer location before applying functors in generated code
  (mirage/mirage#1539 @samoht, fixes mirage/mirage#1520 @hannesm)
- BUGFIX: fix off-by-one locations for mirage/main.ml (mirage/mirage#1540 @samoht, fixes
  mirage/mirage#1528 @hannesm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants