Skip to content

Needed: utility to surface properties and methods of base type #15

@jackfoxy

Description

@jackfoxy

A useful utility would do one-time code generation creating source to populate all the methods and properties of the underlying type as well as functions from the type's module (if it exists), probably using reflection, for the dependent type. Does not have to be fancy. Does not have to be part of the runtime (although I can imagine it could be, at least to produce generated code as a string), and does not need to be part of the design time either. Of course custom coding may still be required in some cases.

This would make #1 less of an issue.

Example:

module rec RecursiveModule =
  module MyType =
    let createBaseTypeElement (config : ConfigType) (value : T1) =
        ...

    type MyTypeValidatorOrDiscriminator(config) = 
        inherit Pi<ConfigType, T1, BaseType>(config, createBaseTypeElement )

    // insert generated properties and functions here, operating on MyType.Value
    let BaseTypeMethod1 (x : MyType) = ...
    ...

  type MyType = DependentType<MyType.MyTypeValidatorOrDiscriminator, ConfigType, T1, BaseType>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions