-
Notifications
You must be signed in to change notification settings - Fork 22
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
gap_julia should check if julia_obj is an MPtr #22
Comments
I would guess this should be an error then. Maybe try to convert it using the conversion function |
Well, that goes back to the question I had yesterday: Why is Personally, I'd rather go the other way: I would not perform any conversion except the bare minimum (i.e. dealing with T_INT / T_FFE when going from GAP to Julia) in both directions; at least in the lowest level code. If automatic conversions are deemed desirable in some or all cases, then this could be implemented in a higher level. This way, at least the user a chance to bypass the automatic conversion in situations where this is beneficial. |
Yep, this seems reasonable. |
Ah, to clarify and finish that thought: if the input is a Julia object which is not an MPtr, or an T_FFE wrapper (or perhaps also a machine integer), then there is a choice between producing an error, or automatically wrapping it into a T_JULIA. I think the latter is harmless and strictly superior to an error, as it is the bare minimum one needs to do. A third option is to provide two functions: one which produces an error resp. wraps into a T_JULIA; the other automatically calls ConvertedFromJulia, for convenience |
All in all though, this is just theoretical wanking, it's best to start writing more complex code, and then seeing what one ends up needing. I.e. be ready to revise whatever decision is made now ;-) |
Currently, this function is really just used in a single case: Calling GAP functions from Julia. I think making the object a |
This also means that we might want to use a different pattern in other places. |
indeed, and based on that, one can easily write a Julia function which first passes all arguments through |
... if julia_obj is not an MPtr, it should take appropriate steps, e.g. raise an error; or return NULL and then let
call_gap_func
check for NULL, and raise an error / return a suitable "fail" indicator.The text was updated successfully, but these errors were encountered: