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

Feature request: var oldAsin=asin; copies the function #445

Closed
user202729 opened this issue Apr 26, 2024 · 2 comments
Closed

Feature request: var oldAsin=asin; copies the function #445

user202729 opened this issue Apr 26, 2024 · 2 comments

Comments

@user202729
Copy link

Currently the behavior is

var g=asin;
    ^
a.asy: 1.5: could not infer type of initializer

If I understood correctly, the error will be raised when there are multiple overloads of the function in question (asin here).
But in this case I think the reasonable option is to copy all options.

@johncbowman
Copy link
Member

You can't copy all versions of asin to g. Here's an example of how to pick a particular one:

typedef real realfcn(real);
var g=(realfcn) asin;

@charlesstaats
Copy link
Contributor

If I understand correctly, the feature request was that the line

var g = asin;

should create multiple variables named g, each with a different signature. We already do something like this with unravel and access; for instance, the line

from math access intersect as g;

will result in two different variables named g (with different signatures). So the proposed feature should definitely be possible to implement if we were sufficiently motivated.

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

No branches or pull requests

3 participants