I’m not exactly sure where to ask questions about PPX attributes and extensions. Would this be the place? Or maybe some other, more specialized mailing-list? For concreteness, the example that drove my post was:
It seems that “algebraic attributes” on a class-signature method-decl, are the same as “item attributes” on that decl. Is this intended? I assume so, but figure it’s good to check.
{| class type ct = object method [@argle] foo : int [@@bargle] end ;; |} |> Official.Implem.pa |> Official.Implem.pr |> print_string ;;
class type ct = object method foo : int[@@argle ][@@bargle ] end- : unit = ()
Another question (and truly, this is just for education – I’ve checked all the relevant locations, and am not confused, just curious):
It seems (checking the menhir parser as well as the manual) "letop"s (for monads) do not enjoy attributes the way that "let"s do? Looking at the AST, it seems that there’s a “Pexp_letop” constructor (to mirror the “Pexp_let”), but nowhere in the “binding_op” (vs. “value_binding”) to stash attributes.
@Chet_Murthy I don’t believe it was intentional; would you like to submit a PR to implement attribute support for binding operators, solving @anmonteiro’s issue?
grin Yep, I’d be happy to! I’ll get on that right away. I also found a couple of bugs (erm … typos, omissions) in the manual in the section on attributes – I assume I can submit a PR to fix those also?
The only one that was material was about the “open” statement. In structures, the open statement does not take a module-path, but rather a module-expression:
open struct let x = 3 end ;;
# x ;;
- : int = 3
in this sense, open is to be contrasted with include, I guess.
include struct let x = 4 end ;;
val x : int = 4
# x ;;
- : int = 4