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

Added support for extensions, including usage and args check - use it to add math functions #96

Merged
merged 14 commits into from
Aug 4, 2024

Conversation

ldemailly
Copy link
Member

@ldemailly ldemailly commented Aug 3, 2024

example with math.Pow() exposed as pow(float1 float2) (and auto convert from integer)

Screenshot 2024-08-03 at 8 10 55 AM

Fixes #9, #41

@ldemailly ldemailly requested a review from ccoVeille August 3, 2024 15:00
@ldemailly ldemailly changed the title Added pretty cool support for extensions, including usage and args check Added support for extensions, including usage and args check Aug 3, 2024
}
}

func pow(args []object.Object) object.Object {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't use a variadic or simply have 2 parameter, it might be a huge refactoring but it would be better I think

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean? MaxArgs -1 is variadic (and variadic is same as [] anyway)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be pow(val, exp)

Or pow(args ...object.Object)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes... so that would be like it is today MinArgs=MaxArgs=2

the second one is MinArgs=0 MaxArgs=-1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See 7d759b8 for sprintf integration as variadic example

@ldemailly ldemailly changed the title Added support for extensions, including usage and args check Added support for extensions, including usage and args check - use it to add math functions Aug 3, 2024
@ccoVeille
Copy link
Contributor

In one commit you said "gofump, instead of gofumpt"

@ldemailly
Copy link
Member Author

@ccoVeille I'm working on a grol side variadic support off this branch but... I think we should merge this first?

@ldemailly ldemailly mentioned this pull request Aug 4, 2024
@ldemailly ldemailly merged commit 4d9664f into main Aug 4, 2024
1 check passed
@ldemailly ldemailly mentioned this pull request Aug 5, 2024
@ldemailly ldemailly deleted the extensions_1 branch August 10, 2024 21:39
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

Successfully merging this pull request may close these issues.

Add "extension" internal functions (calling into a go function), with variadic params, param types etc
2 participants