Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSL should show when the implementation of a function is in code (ie Java) #773

Open
Oblongs opened this issue Jun 11, 2024 · 3 comments
Open
Labels
enhancement New feature or request subject: model validation This issue is about validation of Rosetta models, such as the type system subject: syntax This issue is about the syntax of Rosetta

Comments

@Oblongs
Copy link

Oblongs commented Jun 11, 2024

Some functions are implemented using helper code behind the scenes, using Java. These implementations override everything that exists in the function definition in the DSL.

There should be a way of making this visible in the DSL definition such that:

  • the reader of the function knows that there is a hidden implementation
  • any code added to the function creates a syntax error (to prevent accidental addition of code that will be ignored)
  • an implementation cannot override the function without the designation in the function.

This could be annotation in the function, eg:

func codeImplementation:
   inputs:   foo Bar (1..1)
   outputs:  boo Far (1..1)

   [codeImplementation]
@dschwartznyc
Copy link

rather than focusing on whether the implementation is in Java specifically, could the DSL note when a function defines an interface with no implementation? generators could then take that as a signal for native implementation or to manage the lack of one (throw an exception?)

@SimonCockx
Copy link
Contributor

This would be useful to have. Agreed on all parts , except:

an implementation cannot override the function without the designation in the function.

I think this is not desirable. Overriding existing implementations in Java is sometimes needed in (client-specific) extensions of the CDM/DRR model. We want to keep this possibility. However, I do agree that this should be exceptional, and that in the usual case only Rune functions that do not have a Rune implementation should be overridden.

Couple of other syntax ideas:

func MyFunc:
  [codeImplementation]
  inputs:   foo Bar (1..1)
  outputs:  boo Far (1..1)
abstract func MyFunc:
  inputs:   foo Bar (1..1)
  outputs:  boo Far (1..1)
func MyFunc:
  [abstract]
  inputs:   foo Bar (1..1)
  outputs:  boo Far (1..1)

@dschwartznyc
Copy link

seems like an abstract designation would be helpful especially since it would allow the generators to distinguish between an empty and a not implemented function

@SimonCockx SimonCockx added enhancement New feature or request subject: syntax This issue is about the syntax of Rosetta subject: model validation This issue is about validation of Rosetta models, such as the type system labels Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request subject: model validation This issue is about validation of Rosetta models, such as the type system subject: syntax This issue is about the syntax of Rosetta
Projects
None yet
Development

No branches or pull requests

3 participants