Skip to content

Add parameter type information to ops.descriptions() output #135

Closed
scijava/incubator
#95

Description

@elevans

Take this minimal example where we ask for information on the "math.subtract" op in Jython from the Fiji script editor:

# get op environoment
from org.scijava.ops.api import OpEnvironment
ops = OpEnvironment.getEnvironment()

print(ops.descriptions("math.subtract"))

This produces the following output:

[math.subtract(
	 Inputs:
		I1 input1
		I2 input2
	 Containers (I/O):
		O result
)
, math.sub(
	 Inputs:
		java.lang.Number input1
		java.lang.Number input2
	 Outputs:
		java.lang.Double output1
)
Aliases: [math.subtract]
]

What types are the input (I1 and I2) and output (O)? After talking to Gabe, I learned they are RealTypes. The output from ops.descriptions() does not indicate that these are RealTypes. How can we display the parameter types here?

Activity

  1. added this to the 1.0.0 milestone on Sep 26, 2023
  2. ctrueden commented on Sep 26, 2023

    @ctrueden
    Member
    • If N extends Number we could just put Number, especially if multiple arguments don't use the same N.
    • If I1 extends RealType<I1> we could just put RealType, although that's imprecise.
    • If I1 extends RealType<I1> & NativeType<I1> we could just put RealType (i.e. use the first bound)—or we could put RealType+NativeType with our own homebrewn syntax shorthand.
    • If Img<T> where T extends RealType<T>, we could put Img i.e. erase the generics.
    • Should we always erase generics? Or should there be two modes: simple and advanced?
      • If advanced is a mode we want to support, I would favor keeping the type variables in a Java style, like:
        <T extends RealType<T> & NativeType<T>> Img<T> image1
        But not for simple mode, obviously.
  3. ctrueden commented on Sep 26, 2023

    @ctrueden
    Member

    Tentatively: the descriptions method can be augmented to support two modes via a boolean simple which uses shorthand types with erased generics when true (the default), but fully elucidates the generic types and type variables when false.

  4. linked a pull request that will close this issuePartition Simplification Framework #95on Nov 16, 2023
  5. self-assigned this
    on Nov 16, 2023
  6. added a commit that references this issue on May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions