Class VoidObject
Dummy type used to fulfill the requirements of the Expr.IVisitor<TR> and Stmt.IVisitor<TR> type parameters
For some use cases of the IVisitor interfaces mentioned above, we need to be able to provide a type parameter (typically "object"). Instead of hard-wiring these interfaces to return "object", we have made them be a couple of type-parameterized interfaces. However, for other use cases the return type does not make sense.
Since "void" is not a type in .NET, we must use something else than void to describe "no return value". The VoidObject is an answer to this question. Given that it is abstract, it can never be instantiated. A visitor using this type as type parameter is expected to return "VoidObject.Void" from all its methods.
Inheritance
Namespace: Perlang
Assembly: Perlang.Common.dll
Syntax
public abstract class VoidObject : object
Remarks
This link goes into detail in explaining how "void" works in .NET: https://softwareengineering.stackexchange.com/a/131099/87701.
Properties
| Improve this Doc View SourceVoid
Gets a value indicating that no meaningful return value was provided.
Declaration
public static VoidObject Void { get; }
Property Value
Type | Description |
---|---|
VoidObject |