Skip to content

Function of_type for getting an instance for a given type name - #466

Merged
joente merged 1 commit into
mainfrom
of-type
Oct 15, 2026
Merged

joente merged 1 commit into
mainfrom
of-type

Conversation

@joente

@joente joente commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Description

For a single ID we have no direct function to load the instance for a dynamic type name.

If known, we can simple write:

t = T(123);

But when dynamic, we have to write something like this:

type_name = 'T';

// use map_type for dynamic type name
t = [123].map_type(type_name)[0];

// or using thing(..) + assert(..)
t = thing(123); 
assert(type(t) == type_name);

This PR introduces a dedicated function for this purpose for the int type:

(123).of_type(type_name);

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Test collection functions

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • New and existing unit tests pass locally with my changes

@joente
joente merged commit bb9ece9 into main Oct 15, 2026
1 check passed
@joente
joente deleted the of-type branch October 15, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant