Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Escape Simple-ML keywords when used as name #328

Closed
lars-reimann opened this issue Dec 5, 2021 · 1 comment
Closed

Escape Simple-ML keywords when used as name #328

lars-reimann opened this issue Dec 5, 2021 · 1 comment
Assignees
Labels
enhancement 💡 New feature or request

Comments

@lars-reimann
Copy link
Member

lars-reimann commented Dec 5, 2021

Is your feature request related to a problem? Please describe

Currently the created stubs have a few remaining syntax errors. These are caused by Simple-ML keywords being used as names of API elements. For example, some parameters are called step in sklearn.

Desired solution

It's now possible to use keywords as names by enclosing them in ``, e.g. `step`. Here's the full list of Simple-ML keywords:

  • _
  • and
  • annotation
  • as
  • attr
  • callable
  • class
  • enum
  • false
  • fun
  • import
  • in
  • lambda
  • not
  • null
  • or
  • out
  • package
  • static
  • step
  • sub
  • super
  • true
  • union
  • val
  • vararg
  • where
  • workflow
  • yield

Additionally, the API elements should be marked with the Simple-ML @PythonName annotation (not to be confused with the annotations of the API editor), which contains the corresponding name in the Python API.

Example

Currently generated:

fun f(step: Any?)

What should be generated, since step is a keyword in Simple-ML:

fun f(@PythonName("step") `step`: Any?)
@lars-reimann lars-reimann added the enhancement 💡 New feature or request label Dec 5, 2021
@lars-reimann lars-reimann moved this to Backlog in Safe-DS Dec 5, 2021
@lars-reimann lars-reimann moved this from Backlog to To do in Safe-DS Dec 10, 2021
@lars-reimann
Copy link
Member Author

Won't be needed once #327 is done.

Repository owner moved this from To do to ✔️ Done in Safe-DS Dec 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement 💡 New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants