Skip to content

investigate destruct_ pattern #29

@phlegmaticprogrammer

Description

@phlegmaticprogrammer

Currently, destruction is done via this pattern

match Hey
  case Hey ! => 
end 

the variant

match Hey
  case Hey =>
end

only works for values of type cexp . Is the destruction pattern necessary? Shouldn't the first variant vanish and just leave the second variant on the table ? A counter argument is when doing type definitions:

typedef suit Diamonds, Spades, Hearts, Clubs

This would then not only match actual cexps, but everything that corresponds to the destructors Diamonds, ... That's usually NOT what you want. On the other hand, the following typedef would be OK (but more tedious to write down):

typedef suit Diamonds = Diamonds, Spades = Spades, Hearts = Hearts, Clubs = Clubs

There should be a more elegant way to deal with all these things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions