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

Remove JuliaModule #1041

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 16 additions & 21 deletions pkg/JuliaInterface/gap/JuliaInterface.gd
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@
#! The result is <K>true</K> if and only if <A>obj</A> is a pointer to a
#! &Julia; object.
#!
#! The results of <Ref Func="JuliaModule"/> are always in
#! <Ref Filt="IsJuliaObject" Label="for IsObject"/>.
#! @BeginExampleSession
#! gap> julia_fun:= JuliaEvalString( "sqrt" );
#! <Julia: sqrt>
Expand All @@ -107,12 +105,22 @@
#! <Julia: 1.4142135623730951>
#! gap> IsJuliaObject( julia_val );
#! true
#! gap> julia_x:= JuliaEvalString( "x = 4" );
#! @EndExampleSession
#! However not every object living on the Julia side is in this filter.
#! For example Julia booleans and small <C>Int</C> values are directly
#! translated to GAP booleans and small integers, while for Julia functions
#! and wrappers dedicated wrappers are used for improved efficiency
#! respectively additional features.
#! @BeginExampleSession
#! gap> JuliaEvalString( "x = 4" );;
#! gap> Julia.x;
#! 4
#! gap> IsJuliaObject( julia_x );
#! gap> IsJuliaObject( Julia.x );
#! false
#! gap> IsJuliaObject( Julia.sqrt );
#! false
#! gap> IsJuliaObject( Julia.Main );
#! false
#! gap> IsJuliaObject( JuliaModule( "Main" ) );
#! true
#! @EndExampleSession
DeclareCategory( "IsJuliaObject", IsObject );

Expand All @@ -136,8 +144,8 @@ BindGlobal("TheTypeJuliaObject", NewType( JuliaObjectFamily, IsJuliaObject ));
#! should <E>not</E> be in the filter
#! <Ref Filt="IsJuliaObject" Label="for IsObject"/>.
#!
#! Examples of objects in <Ref Filt="IsJuliaWrapper" Label="for IsObject"/>
#! are the return values of <Ref Func="JuliaModule"/>.
#! For example, any Julia modules such as <C>Julia.Base</C> are
#! in the filter <Ref Filt="IsJuliaWrapper" Label="for IsObject"/>.
DeclareCategory( "IsJuliaWrapper", IsObject );

#! @Arguments obj
Expand Down Expand Up @@ -301,19 +309,6 @@ DeclareGlobalFunction( "JuliaFunction" );
#! @EndExampleSession
DeclareGlobalVariable( "Julia" );

#! @Arguments name
#! @Returns a &Julia; object
#! @Description
#! Returns the &Julia; object that points to the &Julia; module
#! with name <A>name</A>.
#! @BeginExampleSession
#! gap> gapmodule:= JuliaModule( "GAP" );
#! <Julia: GAP>
#! gap> gapmodule = JuliaPointer( Julia.GAP );
#! true
#! @EndExampleSession
DeclareGlobalFunction( "JuliaModule" );

#! @Arguments juliaobj
#! @Returns a string.
#! @Description
Expand Down
15 changes: 0 additions & 15 deletions pkg/JuliaInterface/gap/JuliaInterface.gi
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,6 @@ InstallGlobalFunction( JuliaTypeInfo,
end );


InstallGlobalFunction( JuliaModule,
function( name )
if not IsString( name ) then
Error( "JuliaModule: <name> must be a string" );
fi;
if not IsBound( Julia.(name) ) then
Error( "JuliaModule: Module <name> does not exist, did you import it?" );
fi;
if not IsJuliaModule( Julia.(name) ) then
Error( "JuliaModule: <name> is not a module" );
fi;
return JuliaPointer( Julia.(name) );
end );


InstallGlobalFunction( GetJuliaScratchspace,
function( key )
if not IsString( key ) then
Expand Down
12 changes: 1 addition & 11 deletions pkg/JuliaInterface/tst/utils.tst
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ gap> JuliaSymbol("");
gap> JuliaSymbol(1);
Error, JuliaSymbol: <name> must be a string (not the integer 1)

##
gap> JuliaModule("Base");
<Julia: Base>
gap> JuliaModule("This_Module_Does_Not_Exist");
Error, JuliaModule: Module <name> does not exist, did you import it?
gap> JuliaModule(1);
Error, JuliaModule: <name> must be a string
gap> JuliaModule( "sqrt" );
Error, JuliaModule: <name> is not a module

##
gap> _JuliaGetGlobalVariable(0);
Error, _JuliaGetGlobalVariable: <name> must be a string (not the integer 0)
Expand All @@ -74,7 +64,7 @@ gap> _JuliaGetGlobalVariableByModule("Base","sqrt");
Error, sqrt is not a module
gap> _JuliaGetGlobalVariableByModule("sqrt","Base");
<Julia: sqrt>
gap> _JuliaGetGlobalVariableByModule("sqrt", JuliaModule("Base"));
gap> _JuliaGetGlobalVariableByModule("sqrt", JuliaPointer(Julia.Base));
<Julia: sqrt>

##
Expand Down
Loading