Skip to content

Add property, excludeStructures, that controls which built-in structures are visible #342

@julianhyde

Description

@julianhyde

Add a system property that controls which built-in structures are included in the environment, so that test-only structures do not pollute the default environment.

In #271 we added synthetic test aggregates (testBagSum, testListSum, testOverloadedSum) to the Relational structure. These are useful for testing but should not be visible to users in the default environment.

We need a mechanism to conditionally include built-in functions based on whether their structure name matches a pattern. This would allow:

  • Test-only functions to be excluded from the default environment
  • Users to opt in to experimental or test structures via a property
  • A clean separation between production and test built-ins

Specification

Move the test aggregates from Relational into a new Test
structure.

Add a new system property:

  • Name: excludeStructures
  • Type: String
  • Default: "^Test$"
  • Semantics: A Java regular expression. Any built-in structure whose name matches the regex is excluded from the environment.

Examples

(*) Default: Test structure is excluded.
Sys.show "excludeStructures";
> val it = SOME "^Test$" : string option

(*) Include all structures (empty pattern matches nothing).
Sys.set ("excludeStructures", "");

(*) Exclude 'Test' and 'Foo' but not 'Testament'.
Sys.set ("excludeStructures", "^(Test|Foo)$");

(*) Restore default.
Sys.unset "excludeStructures";

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions