trilogy-data / trilogy-data/pytrilogy

Anonymous concepts via function dot access

Open
#75 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.