Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006476OCamlOCaml generalpublic2014-07-02 19:182014-07-04 14:16
Reporterlpw25 
Assigned Tofrisch 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version4.02.0+devFixed in Version4.02.0+dev 
Summary0006476: Attributes on class signatures
DescriptionCurrently, attributes and extensions are allowed for class types but not class signatures. For example:

    # class type c = object end [@foo];;
    Characters 26-28:
      class type c = object end [@foo];;
                                ^^
    Error: Syntax error

    # class type c = [%foo];;
    Characters 15-17:
      class type c = [%foo];;
                     ^^
    Error: Syntax error

The attached patch fixes this.
Tagspatch
Attached Filespatch file icon clsig-attr.patch [^] (806 bytes) 2014-07-02 19:18 [Show Content]

- Relationships

-  Notes
(0011784)
frisch (developer)
2014-07-03 17:50

Thanks, well spotted. I've integrated your patch to the 4.02 branch.

Neither the previous version nor the new one supports putting attributes on "arrow" class_types, as in:

 module type S = sig class c : (int -> object end) [@foo] end;;

Adding an "LPAREN class_type RPAREN attribute" production to class_type introduces conflicts. This is certainly not critical, but if you have a nice suggestion on how to address that, let me know!
(0011785)
lpw25 (developer)
2014-07-03 19:16

> Adding an "LPAREN class_type RPAREN attribute" production to class_type introduces conflicts. This is certainly not critical, but if you have a nice suggestion on how to address that, let me know!

I had a look at this when writing the patch, but it seems like it would be very difficult to support parentheses there. Some of the conflicts are easy to fix, but the conflict which appears in code like:

    ((foo -> bar)) vs. ((foo -> bar) -> baz)

is pretty awkward since `foo` should reduce to a class argument in the first but not the second, and we can only tell which it is when we see the second closing parenthesis.
(0011788)
frisch (developer)
2014-07-04 14:16

Ok, thanks. I doubt people will really need to use attributes on non-signature class types.

- Issue History
Date Modified Username Field Change
2014-07-02 19:18 lpw25 New Issue
2014-07-02 19:18 lpw25 File Added: clsig-attr.patch
2014-07-02 19:18 lpw25 Tag Attached: patch
2014-07-03 17:50 frisch Note Added: 0011784
2014-07-03 17:50 frisch Assigned To => frisch
2014-07-03 17:50 frisch Status new => assigned
2014-07-03 17:50 frisch Fixed in Version => 4.02.0+dev
2014-07-03 17:50 frisch Target Version => 4.02.0+dev
2014-07-03 19:16 lpw25 Note Added: 0011785
2014-07-04 14:16 frisch Note Added: 0011788
2014-07-04 14:16 frisch Status assigned => resolved
2014-07-04 14:16 frisch Resolution open => fixed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker