Skip to content

Unexpected verbose output for ops.help("create") #167

Closed
scijava/incubator
#113

Description

@elevans

The improvements made to ops.help() have been great for helping me explore the new API. But there is some unexpected behavior like ops.help("create").

For example here's the output for deconvolve:

print(ops.help("deconvolve"))
Names:
	> deconvolve.accelerate
	> deconvolve.firstGuess
	> deconvolve.normalizationFactor
	> deconvolve.richardsonLucy
	> deconvolve.richardsonLucyCorrection
	> deconvolve.richardsonLucyTV
	> deconvolve.richardsonLucyUpdate

But when I do the same for create I get this:

print(ops.help("create"))
Ops:
	> create(
		 Inputs:
			Dimensions null
			Object null
		 Outputs:
			ImgFactory<Object> output1 -> imgFactory
	)
	Aliases: [create.imgFactory]
	
	> create(
		 Inputs:
			Dimensions null
			Type null
		 Outputs:
			Img<Type> output1 -> img
	)
	Aliases: [create.img]
	
	> create(
		 Inputs:
			Dimensions null
			Type null
			ImgFactory<Type> null
		 Outputs:
			Img<Type> output1 -> img
	)
	Aliases: [create.img]
	
	> create(
		 Inputs:
			Dimensions null
			IntegerType null
		 Outputs:
			ImgLabeling<Object, IntegerType> output1 -> imgLabeling
	)
	Aliases: [create.imgLabeling]
	
	> create(
		 Inputs:
			Dimensions null
			IntegerType null
			ImgFactory<IntegerType> null
		 Outputs:
			ImgLabeling<Object, IntegerType> output1 -> imgLabeling
	)
	Aliases: [create.imgLabeling]
	
	> create(
		 Inputs:
			double[][] null
			ComplexType null
		 Outputs:
			RandomAccessibleInterval<ComplexType> output1 -> kernelRAI
	)
	Aliases: [create.kernel]
	
	> create(
		 Inputs:
			double[] null
			Integer null
			ComplexType null
		 Outputs:
			RandomAccessibleInterval<ComplexType> output1 -> biGaussKernelRAI
	)
	Aliases: [create.kernel2ndDerivBiGauss]
	
	> create(
		 Inputs:
			double[] null
			Integer null
			ComplexType null
		 Outputs:
			RandomAccessibleInterval<ComplexType> output1 -> biGaussKernelRAI
	)
	Aliases: [create.kernelBiGauss]
	
	> create(
		 Inputs:
			Dimensions null
			Double null
			Double null
			Double null
			Double null
			Double null
			Double null
			Double null
			ComplexType+NativeType null
		 Outputs:
			Img<ComplexType+NativeType> output1 -> diffractionKernelRAI
	)
	Aliases: [create.kernelDiffraction]
	
	> create(
		 Inputs:
			double[] null
			double[] null
			ComplexType null
		 Outputs:
			RandomAccessibleInterval<ComplexType> output1 -> gaborKernelRAI
	)
	Aliases: [create.kernelGabor]
	
	> create(
		 Inputs:
			Double null
			double[] null
			ComplexType null
		 Outputs:
			RandomAccessibleInterval<ComplexType> output1 -> gaborKernelRAI
	)
	Aliases: [create.kernelGabor]
	
	> create(
		 Inputs:
			double[] null
			ComplexType null
		 Outputs:
			RandomAccessibleInterval<ComplexType> output1 -> gaussKernelRAI
	)
	Aliases: [create.kernelGauss]
	
	> create(
		 Inputs:
			Double null
			Integer null
			ComplexType null
		 Outputs:
			RandomAccessibleInterval<ComplexType> output1 -> gaussKernelRAI
	)
	Aliases: [create.kernelGauss]
	
	> create(
		 Inputs:
			double[] null
			ComplexType null
		 Outputs:
			RandomAccessibleInterval<ComplexType> output1 -> logKernelRAI
	)
	Aliases: [create.kernelLog]
	
	> create(
		 Inputs:
			Double null
			Integer null
			ComplexType null
		 Outputs:
			RandomAccessibleInterval<ComplexType> output1 -> logKernelRAI
	)
	Aliases: [create.kernelLog]
	
	> create(
		 Inputs:
			ComplexType null
		 Outputs:
			RandomAccessibleInterval<ComplexType> output1 -> sobelKernelRAI
	)
	Aliases: [create.kernelSobel]
	
	> create(
		 Inputs:
			Type null
		 Outputs:
			Type output1 -> type
	)
	Aliases: [create.type]
	
	> create(
		 Inputs:
		 Outputs:
			BitType output1 -> output
	)
	Aliases: [create.bit]
	
	> create(
		 Inputs:
		 Outputs:
			ByteType output1 -> output
	)
	Aliases: [create.byte]
	
	> create(
		 Inputs:
		 Outputs:
			ComplexFloatType output1 -> output
	)
	Aliases: [create.cfloat32]
	
	> create(
		 Inputs:
		 Outputs:
			ComplexDoubleType output1 -> output
	)
	Aliases: [create.cfloat64]
	
	> create(
		 Inputs:
		 Outputs:
			FloatType output1 -> output
	)
	Aliases: [create.float32]
	
	> create(
		 Inputs:
		 Outputs:
			DoubleType output1 -> output
	)
	Aliases: [create.float64]
	
	> create(
		 Inputs:
		 Outputs:
			IntType output1 -> output
	)
	Aliases: [create.int32]
	
	> create(
		 Inputs:
		 Outputs:
			LongType output1 -> output
	)
	Aliases: [create.int64]
	
	> create(
		 Inputs:
		 Outputs:
			ShortType output1 -> output
	)
...

I expected an output like this:

	> create.Img
	> create.ImgFactory
	> create.ImgLabeling
	> create.ImgPlus
	> create.kernel
	> create.kernelDiffraction
	> create.kernelGabor
...

There are a few other namespaces that do this, which I think is okay if there are no sub methods (i.e. namespace.method) but it didn't make sense to me in the create namespace case.

Activity

  1. added this to the 1.0.0 milestone on Dec 13, 2023
  2. self-assigned this
    on Dec 13, 2023
  3. hinerm commented on Dec 28, 2023

    @hinerm
    Member

    The desired output here is certainly available through the aliases, but that may not always be the case.

    One simple option would be to have a heuristic that abbreviates things if a) there are N+ results (say, N=5) and b) the results actually have aliases.

    But if we're considering changes to the help output I personally would favor moving to something more javadoc-ish that succinctly summarizes the available ops. For something user-facing anything longer than a page of text (~45 lines) feels unwieldy (currently the create help has 572 lines).

    When I'm looking at this output, I have these thoughts:

    • A blank Inputs section can be omitted
    • Can you actually have more than one Output/Container? The pluralization and output numbering implies you can
    • What does output1 -> output tell us? Why have output names at all? Where are they even coming from?
    • Seeing the function name (create) repeated seems unnecessary. It's an implementation detail that the user doesn't care about - the relevant info is that the indicated method is reachable via the op name that was given.
    • With the parentheses and multiple levels of indentation, I find it hard to follow the output
    • Parameter names that are the same as the type aren't helpful and may as well just be single characters

    Personally I would want to see a table like this:

    "create" ops Aliases
    (Dimensions dimensions, Object type) -> ImgFactory create.imgFactory
    (Dimensions dimensions, Object type) -> Img create.img
    (double[][] values, ComplexType type) -> RandomAccessibleInterval create.kernel

    I also noticed that if an op is matched by its alias, that isn't reflected in the result. e.g.

    System.out.println(ops.help("create.img"));
    
    Ops:
    	> create(
    		 Inputs:
    			Dimensions dimensions
    			Type type
    		 Outputs:
    			Img<Type> output1 -> img
    	)
    	Aliases: [create.img]
    	
    	> create(
    		 Inputs:
    			Dimensions dimensions
    			Type type
    			ImgFactory<Type> factory
    		 Outputs:
    			Img<Type> output1 -> img
    	)
    	Aliases: [create.img]
    

    Whereas I think it would be more flexible to report the queried command, and then group all un-queried aliases together, e.g.:

    "create.img" ops Aliases
    (Dimensions dimensions, Type type) -> Img create
    (Dimensions dimensions, Type type, ImgFactory factory) -> Img create

    Of course, this probably breaks down for Ops with large numbers of parameters... but wrapping lines may be sufficient.

    @ctrueden @elevans @gselzer thoughts/feelings?

  4. gselzer commented on Dec 28, 2023

    @gselzer
    Member

    Here are my thoughts @hinerm:

    The desired output here is certainly available through the aliases, but that may not always be the case.

    One simple option would be to have a heuristic that abbreviates things if a) there are N+ results (say, N=5) and b) the results actually have aliases.

    What do you mean by abbreviation? It would be one thing to add additional simplifiers to e.g. reduce down some of those create Ops, but I do think that we would need to actually list all Ops. I think whether or not I'd be in favor depends on what you're thinking...

    But if we're considering changes to the help output I personally would favor moving to something more javadoc-ish that succinctly summarizes the available ops. For something user-facing anything longer than a page of text (~45 lines) feels unwieldy (currently the create help has 572 lines).

    Yes, I agree that we probably need something better. More on that below.

    When I'm looking at this output, I have these thoughts:

    • A blank Inputs section can be omitted

    Yup, good idea.

    • Can you actually have more than one Output/Container? The pluralization and output numbering implies you can

    No, you cannot - we can fix that too.

    • What does output1 -> output tell us? Why have output names at all? Where are they even coming from?

    Well, they come from the Member - all Members need a name so we default it with output1, although we could special-case ItemIO.OUTPUT members in OpDescriptionGenerator to ignore them. The output is coming from the description of the @return tag in the javadoc - if you don't like it, we should edit the javadoc!

    • Seeing the function name (create) repeated seems unnecessary. It's an implementation detail that the user doesn't care about - the relevant info is that the indicated method is reachable via the op name that was given.

    create is the name of the Op - we actually don't write the function name, because like you said it's an implementation detail.

    • With the parentheses and multiple levels of indentation, I find it hard to follow the output

    I'm not sure what you'd prefer, when we're working within the confines of a String. I'll leave the table discussion to below.

    • Parameter names that are the same as the type aren't helpful and may as well just be single characters

    Sure, we could add that.

    Personally I would want to see a table like this:
    "create" ops Aliases
    (Dimensions dimensions, Object type) -> ImgFactory create.imgFactory
    (Dimensions dimensions, Object type) -> Img create.img
    (double[][] values, ComplexType type) -> RandomAccessibleInterval create.kernel

    Your example there looks nice, but there are a number of technical questions that remain to be answered:

    • Like you mention below, Ops with more parameters (or longer parameter names) will stretch the table.
    • How do we return/display this thing? The only thing I can think of is some TableBasedOpDescriptionGenerator in scijava-ops-legacy that operates via side effects, but that would only work in ImageJ2/Fiji.

    I also noticed that if an op is matched by its alias, that isn't reflected in the result. e.g.

    Yeah, that's a tricky one. What if we ignore the aliases? Is a user really going to want to know the other names you can use to call an Op? Seems like an implementation detail...

    Whereas I think it would be more flexible to report the queried command, and then group all un-queried aliases together, e.g.:
    "create.img" ops Aliases
    (Dimensions dimensions, Type type) -> Img create
    (Dimensions dimensions, Type type, ImgFactory factory) -> Img create

    Of course, this probably breaks down for Ops with large numbers of parameters... but wrapping lines may be sufficient.

    Well, if you agree that we don't need the alias, then we're left with a one-column table, which means we don't even need a table? Maybe we just use whitespace better?

  5. gselzer commented on Jan 2, 2024

    @gselzer
    Member

    @hinerm I set up branch scijava/scijava-ops-engine/refactor-descriptions for progress on this issue. So far I have:

    • Named each result by the searched alias, and removed the aliases section from each Op description
    • Removed the Inputs section from Op descriptions without inputs
    • Removed the plural from the Outputs and Computers (I/O) sections.

    @elevans @ctrueden did you get a chance to reflect on @hinerm's suggestions above?

  6. gselzer commented on Jan 3, 2024

    @gselzer
    Member

    I spent a little more time this morning, and @elevans helped me out a little with the design!

    Here's what ops.help("create") looks like now:

    create:
    	• (ObjectArray<Number>, ObjectArray<Number>)
    		-> ObjectArray<Number>
    	• (ObjectArray<Number>)
    		-> ObjectArray<Number>
    	• ()
    		-> Number
    	• ()
    		-> BitType
    	• ()
    		-> ByteType
    	• ()
    		-> ComplexFloatType
    	• ()
    		-> ComplexDoubleType
    	• ()
    		-> FloatType
    	• ()
    		-> DoubleType
    	• ()
    		-> IntType
    	• ()
    		-> LongType
    	• ()
    		-> ShortType
    	• ()
    		-> Unsigned128BitType
    	• ()
    		-> Unsigned12BitType
    	• ()
    		-> UnsignedShortType
    	• ()
    		-> Unsigned2BitType
    	• ()
    		-> UnsignedIntType
    	• ()
    		-> Unsigned4BitType
    	• ()
    		-> UnsignedLongType
    	• ()
    		-> UnsignedByteType
    	• (ArrayImg<NativeType, ArrayDataAccess>)
    		-> ArrayImg<NativeType, ArrayDataAccess>
    	• ()
    		-> Vector3d
    	• ()
    		-> Vector3f
    	• (Dimensions, Object)
    		-> ImgFactory<Object>
    	• (Dimensions)
    		-> ImgFactory<DoubleType>
    	• (Img<Object>)
    		-> ImgFactory<Object>
    	• ()
    		-> ImgFactory<DoubleType>
    	• (Dimensions, Type)
    		-> Img<Type>
    	• (Dimensions, Type, ImgFactory<Type>)
    		-> Img<Type>
    	• (IterableInterval<Type>)
    		-> Img<Type>
    	• (Img<Type>)
    		-> Img<Type>
    	• (ObjectArray<Number>)
    		-> Img<DoubleType>
    	• (Interval)
    		-> Img<DoubleType>
    	• (RandomAccessibleInterval<Type>)
    		-> Img<Type>
    	• (Dimensions, IntegerType)
    		-> ImgLabeling<Object, IntegerType>
    	• (Dimensions, IntegerType, ImgFactory<IntegerType>)
    		-> ImgLabeling<Object, IntegerType>
    	• (Img<IntegerType>)
    		-> ImgLabeling<Object, IntegerType>
    	• (double[][], ComplexType)
    		-> RandomAccessibleInterval<ComplexType>
    	• (double[][])
    		-> RandomAccessibleInterval<DoubleType>
    	• (ObjectArray<Number>, Number)
    		-> RandomAccessibleInterval<DoubleType>
    	• (ObjectArray<Number>, Number, ComplexType)
    		-> RandomAccessibleInterval<ComplexType>
    	• (Dimensions, Number, Number, Number, Number, Number, Number, Number, ComplexType+NativeType)
    		-> Img<ComplexType+NativeType>
    	• (Number, ObjectArray<Number>)
    		-> RandomAccessibleInterval<ComplexDoubleType>
    	• (ObjectArray<Number>, ObjectArray<Number>)
    		-> RandomAccessibleInterval<ComplexDoubleType>
    	• (Number, ObjectArray<Number>)
    		-> RandomAccessibleInterval<ComplexFloatType>
    	• (ObjectArray<Number>, ObjectArray<Number>)
    		-> RandomAccessibleInterval<ComplexFloatType>
    	• (Number, ObjectArray<Number>)
    		-> RandomAccessibleInterval<DoubleType>
    	• (ObjectArray<Number>, ObjectArray<Number>)
    		-> RandomAccessibleInterval<DoubleType>
    	• (Number, ObjectArray<Number>)
    		-> RandomAccessibleInterval<FloatType>
    	• (ObjectArray<Number>, ObjectArray<Number>)
    		-> RandomAccessibleInterval<FloatType>
    	• (Number, ObjectArray<Number>, ComplexType)
    		-> RandomAccessibleInterval<ComplexType>
    	• (ObjectArray<Number>, ObjectArray<Number>, ComplexType)
    		-> RandomAccessibleInterval<ComplexType>
    	• (ObjectArray<Number>)
    		-> RandomAccessibleInterval<DoubleType>
    	• (Number, Number)
    		-> RandomAccessibleInterval<DoubleType>
    	• (Number, Number, ComplexType)
    		-> RandomAccessibleInterval<ComplexType>
    	• (ObjectArray<Number>, ComplexType)
    		-> RandomAccessibleInterval<ComplexType>
    	• (ComplexType)
    		-> RandomAccessibleInterval<ComplexType>
    	• ()
    		-> LabelingMapping<Object>
    	• (Number)
    		-> LabelingMapping<Object>
    	• (Class<Object>)
    		-> Object
    	• (Type)
    		-> Type
    

    Computers and Inplaces are a little trickier, but here's the solution @elevans and I came up with:

    filter.gauss:
    	• (RandomAccessibleInterval<NumericType>, ObjectArray<Number>, BUFFER:RandomAccessibleInterval<NumericType>)
    		-> None [Fills BUFFER]
    	• (RandomAccessibleInterval<NumericType>, ObjectArray<Number>, OutOfBoundsFactory<NumericType, RandomAccessibleInterval<NumericType>>, BUFFER:RandomAccessibleInterval<NumericType>)
    		-> None [Fills BUFFER]
    	• (RandomAccessibleInterval<NumericType>, Number, BUFFER:RandomAccessibleInterval<NumericType>)
    		-> None [Fills BUFFER]
    	• (RandomAccessibleInterval<NumericType>, Number, OutOfBoundsFactory<NumericType, RandomAccessibleInterval<NumericType>>, BUFFER:RandomAccessibleInterval<NumericType>)
    		-> None [Fills BUFFER]
    

    (Inplaces instead annotate a parameter with MUTABLE and the output type is None [Overwrites MUTABLE]

  7. ctrueden commented on Jan 3, 2024

    @ctrueden
    Member

    I agree with all of @hinerm's suggestions above, and had similar thoughts to what @gselzer already wrote. Here are my current thoughts and questions given the current status above:

    1. Why is this • symbol used? Can we please just use the asterisk *? Or else: use Unicode more thoroughly like → instead of ->? Either way is OK, but let's be consistent.

    2. Did we rename "container" to "buffer" now? I'm OK with that, but I'm not OK with it being called "container" under the hood and "buffer" only in the help. If you guys feel the term "buffer" is friendlier, let's rename it throughout the codebase. FWIW: I do think the term "buffer" is wrong here technically, because a buffer traditionally can be too small for the output, at which point the output stops computing there, whereas with Ops, an exception is presumably thrown if the container is the wrong size? This may be a larger issue for discussion...

    3. I do not like the -> None [Fills BUFFER] and -> None [Overwrites MUTABLE] syntax. It is clunky and I would rather just omit it. If you don't know what a "Buffer" or "Mutable" is, then read the basic Ops introduction, where it is explained.

    4. I'm not sure it's a good idea to leave off the parameter names. Those names exist to make the op's purpose easier to understand, and cutting them for the sake of conciseness seems arbitrary to me. You could just as easily cut the formal types in favor of the names. Furthermore, in languages that support keyword arguments, not knowing the keywords sucks. So probably we just need to have both names and types. But we ought to use the Python/Kotlin-style declaration syntax of image: RandomAccessibleInterval<NumericType> rather than Java's RandomAccessibleInterval<NumericType> image, especially since you are already using the Python/Kotlin-style return value syntax with -> here; mixing them is inconsistent and confusing.

    5. Regarding the create ops: I don't understand why for all of them the name is create while it's only the aliases that have the fully qualified names. Shouldn't it be the other way around, where the shorthand create is simply an alias for each?

    6. I feel like I already discussed this elsewhere (either written or verbal) with @gselzer, but for this specific issue of ops.help("create") conflating the create ops with the create namespace: didn't we agree that we simply want it to show only the create namespace, and leave off the ops? If not: that's how I think it should work (i.e. I agree with @elevans's original expectation here). The fact that these ops all have an alias create in the global namespace is an implementation detail, which doesn't actually have to be that way: let's consider changing it to createContainer to avoid conflation with the create namespace. Then when people want to see all the createContainer ops in one listing, they can just ask for it with ops.help("createContainer").

  8. gselzer commented on Jan 3, 2024

    @gselzer
    Member

    Thanks @ctrueden for responding!

    I agree with all of @hinerm's suggestions above, and had similar thoughts to what @gselzer already wrote. Here are my current thoughts and questions given the current status above:

    1. Why is this • symbol used? Can we please just use the asterisk *? Or else: use Unicode more thoroughly like → instead of ->? Either way is OK, but let's be consistent.

    Oh, yeah, * looks just fine. Let's just use that then.

    1. Did we rename "container" to "buffer" now? I'm OK with that, but I'm not OK with it being called "container" under the hood and "buffer" only in the help. If you guys feel the term "buffer" is friendlier, let's rename it throughout the codebase. FWIW: I do think the term "buffer" is wrong here technically, because a buffer traditionally can be too small for the output, at which point the output stops computing there, whereas with Ops, an exception is presumably thrown if the container is the wrong size? This may be a larger issue for discussion...

    Fair point - let's just keep it container now.

    1. I do not like the -> None [Fills BUFFER] and -> None [Overwrites MUTABLE] syntax. It is clunky and I would rather just omit it. If you don't know what a "Buffer" or "Mutable" is, then read the basic Ops introduction, where it is explained.

    The goal here is to make it clear that (a) one of the input objects will be altered and (b) denote which object it is. I believe that this solution ties those two things together nicely by making use of shared terminology (i.e. the capitalized word in both the output and the input). I am curious as to whether you believe this goal is not important, or whether you have another design that may accomplish it better.

    1. I'm not sure it's a good idea to leave off the parameter names. Those names exist to make the op's purpose easier to understand, and cutting them for the sake of conciseness seems arbitrary to me. You could just as easily cut the formal types in favor of the names. Furthermore, in languages that support keyword arguments, not knowing the keywords sucks. So probably we just need to have both names and types. But we ought to use the Python/Kotlin-style declaration syntax of image: RandomAccessibleInterval<NumericType> rather than Java's RandomAccessibleInterval<NumericType> image, especially since you are already using the Python/Kotlin-style return value syntax with -> here; mixing them is inconsistent and confusing.

    Good catch, I meant to add that but forgot. Note that there's a real crunch for space with this design - for a lot of the image Ops, there's so much text that we wrap lines, and that reduces readability. I'm not saying we shouldn't add names, just noting that space is at a premium with this design.

    1. Regarding the create ops: I don't understand why for all of them the name is create while it's only the aliases that have the fully qualified names. Shouldn't it be the other way around, where the shorthand create is simply an alias for each?

    Since we did away with printing out the aliases of Ops on this branch, we just return all Ops with that name, note that Ops still has no formal definition of an alias - under the hood it's just a bunch of strings.

    1. I feel like I already discussed this elsewhere (either written or verbal) with @gselzer, but for this specific issue of ops.help("create") conflating the create ops with the create namespace: didn't we agree that we simply want it to show only the create namespace, and leave off the ops? If not: that's how I think it should work (i.e. I agree with @elevans's original expectation here). The fact that these ops all have an alias create in the global namespace is an implementation detail, which doesn't actually have to be that way: let's consider changing it to createContainer to avoid conflation with the create namespace. Then when people want to see all the createContainer ops in one listing, they can just ask for it with ops.help("createContainer").

    Okay, so there are two different needs at play here:

    1. The user needs to be able to call Ops that create Objects. In that sense, form equivalence suggests that image creators should probably have a different name from type creators.
    2. The framework needs to be able to access all creator Ops for adaptation.

    With that being said, here's the additional requirement that I'd like to impose with naming, and the changes that will be required:

    • Requirement: All Op names (whether you want to think of ( primary name + aliases) or just a set of names) must conform to namespace\.name i.e. there has to be (at least??) one period in the name to require each name belong to some namespace.
    • Change 1 - All create/copy Ops must have a name that belongs to the create/copy namespace.
    • Change 2 - All create/copy Ops (or at least all of the ones that want to be used by the engine) also declare the name engine.create/engine.copy.
  9. ctrueden commented on Jan 3, 2024

    @ctrueden
    Member

    Requirement: All Op names (whether you want to think of ( primary name + aliases) or just a set of names) must conform to namespace.name i.e. there has to be (at least??) one period in the name to require each name belong to some namespace.

    👍👍

    Change 2 - All create/copy Ops (or at least all of the ones that want to be used by the engine) also declare the name engine.create/engine.copy.

    Sounds good.

    Change 1 - All create/copy Ops must have a name that belongs to the create/copy namespace.

    Why force it? It's not a technical requirement for the Ops engine. Just trying to corral people toward a best practice?

    Ops still has no formal definition of an alias - under the hood it's just a bunch of strings.

    Yep. But I still think there is value in declaring the "best" of the names as the name, and others as aliases. For the engine.create ops, I favor engine.create being given as an alias, not as the most visible name in the declaration. (And same for engine.copy.)

    there's a real crunch for space with this design - for a lot of the image Ops, there's so much text that we wrap lines, and that reduces readability. I'm not saying we shouldn't add names, just noting that space is at a premium with this design.

    I understand, and I think we are all on the same wavelength about this.

    Perhaps we should take a page out of the Python code linter book, and do something like:

    fizzbuzz(fizz: Fizz, buzz: Buzz) -> Result

    for short signatures, and:

    fizzbuzz(
        fizz: Fizz,
        buzz: Buzz,
        scale: int,
        sigma: float,
        image: RandomAccessibleInterval<ObnoxiouslyLongQuasiNumericType>
    ) -> Result

    for signatures exceeding a certain length, say 88 characters?

  10. gselzer commented on Jan 3, 2024

    @gselzer
    Member

    @ctrueden thanks again for the feedback!

    Change 1 - All create/copy Ops must have a name that belongs to the create/copy namespace.

    Why force it? It's not a technical requirement for the Ops engine. Just trying to corral people toward a best practice?

    Well, my point was more that if we make the requirement a requirement we will likely have to change the names of many of the create Ops such that they no longer have names create/copy - they'll have to have a name create.X, if they don't have one already.

    Ops still has no formal definition of an alias - under the hood it's just a bunch of strings.

    Yep. But I still think there is value in declaring the "best" of the names as the name, and others as aliases. For the engine.create ops, I favor engine.create being given as an alias, not as the most visible name in the declaration. (And same for engine.copy.)

    And my point here was that I don't think it really matters, since now we aren't describing Ops with their aliases. The question would then be where you'd see that an Op can be found by multiple names, and I can't really think of one.

    Perhaps we should take a page out of the Python code linter book, and do something like:

    fizzbuzz(fizz: Fizz, buzz: Buzz) -> Result

    for short signatures, and:

    fizzbuzz(
        fizz: Fizz,
        buzz: Buzz,
        scale: int,
        sigma: float,
        image: RandomAccessibleInterval<ObnoxiouslyLongQuasiNumericType>
    ) -> Result

    for signatures exceeding a certain length, say 88 characters?

    Potentially, although keep in mind that I think it looks sillier in our case without the function name (note that I haven't added the parameter names back in yet):

    filter.gauss:
    	• (
                 RandomAccessibleInterval<NumericType>, 
                 ObjectArray<Number>, 
                 BUFFER:RandomAccessibleInterval<NumericType>
    	  ) -> None [Fills BUFFER]
    

    And at that point we'd be so close to adding back some of the things that made @hinerm want the changes:

    • Seeing the function name (create) repeated seems unnecessary. It's an implementation detail that the user doesn't care about the relevant info is that the indicated method is reachable via the op name that was given.
    • With the parentheses and multiple levels of indentation, I find it hard to follow the output

    Also keep in mind that I haven't (yet?) modified helpVerbose - so maybe that can satisfy some of these things you're concerned about?

  11. ctrueden commented on Jan 3, 2024

    @ctrueden
    Member

    If we're only talking about the simple/default help here, then my vote is to cut the types in favor of only the names. Or use drastically simplified types like "image", "number", etc. So then we won't get lines that are "too long" anymore.

  12. elevans commented on Jan 4, 2024

    @elevans
    MemberAuthor

    I agree with @ctrueden here in that we cut the types in favor of only the names for the simpler help call. I'm not sure if using simplified types would be better or add more confusion into the mix.

  13. added a commit that references this issue on Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions