Is there any proposed guideline to name types and distinguish whether is it a concrete or abstract type?
This would be useful to check whether a package has been developed following this rule: Style Guide · The Julia Language
Besides, a method implementation should not be concerned with the specific implementation of a concrete type. Rather, it should only rely on a specific behaviour of its argument(s), which may be provided by several concrete concrete types sharing a common ancestor type.
I know that several abstract types have a Abstract
prefix in their name, hence a correct function signature should be in the form
function foo(arg1::AbstractBar, arg2::AbstractBaz, arg3::AbstractWhatever)
But this looks quite cumbersome to me, I would prefer writing:
function foo(arg1::Bar, arg2::Baz, arg3::Whatever)
and having Concrete
as prefix to the concrete type name.
Another possibility would be to propose a (non-mandatory) guideline to prepend or append a single character to all abstract type names.
For instance, I would like to write:
abstract type ∀Bar end
mutable struct Bar <: ∀Bar
...
end
function foo(arg1::∀Bar...)
since this reminds me that the foo
function works with any of the subtypes of the Bar entity. And ∀
is an upside down A
(for abstract…)
However, the ∀
character actually lead to a syntax error, hence it is not a viable option.
Any other proposal/comment?