trilogy-data / trilogy-data/pytrilogy
Anonymous concepts via function dot access
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 61
- Forks
- 3
- Avg merge
- 7h 18m
- Merged PRs (30d)
- 43
Description
Problem Statement
We by default create functions at parse time for extremely common use cases - such as keys having an automatic .count method.
This lends itself to nice syntax, like
select
customer.creation_date, customer.id.count
However, it's not clear when these helpers would exist by default, and annoying when they don't.
Proposed Solution
Support accessing ANY function that takes a single argument through a dynamically resolved concept
So if a function called 'hash' was registered, then
customer.id.hash would automatically be valid.
This chain should be automatically recursive, so
customer.id.count.hash would be valid
There's a tradeoff here with overlapping with concepts that are named differently. To combat that, propose by default preventing the definition of a concept with a name that would overlap with an anonymous function derived concept.
So for example,
property customer.id.count <- '1'; would throw an error at parse time.
Alternatives Considered
A dedicated signal symbol, like '|' or '>', that would indicate when access was being pushed to a function
so for example
select customer.id>count
or select customer.id|count|hash
Additional Context
Please provide any other information that may be relevant.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by locating the parser, function registration, and concept-resolution logic, then compare their behavior with the examples for customer.id.hash and customer.id.count.hash. Done means single-argument functions resolve through dot access recursively and conflicting concept definitions fail at parse time, with coverage for those cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers, data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100