Hello developers,

I would like to regularize the various is...Type() functions currently 
defined in a few Chapel standard modules and promote them for general 
availability.

PART 1: I'd like feedback on the following set of functions - whether 
they are OK in terms of naming, functionality, etc. They all are param 
functions, returning true if the property holds, false otherwise.

// The following functions correspond to the list of types in the spec.

isVoidType
isBoolType
isIntType    // int(*)
isUintType   // uint(*)
isRealType
isImagType
isComplexType
isStringType

isEnumType
isTupleType

isClassType
isRecordType
isUnionType

isRangeType
isDomainType
isArrayType

isSyncType
isSingleType
isAtomicType

// The following functions combine several of the above.

isPrimitiveType   // primitive types, as defined by the spec, namely:
                   // void, bool, int, uint, real, imag, complex, string

isIntegralType    // int, uint
isNumericType     // int, uint, real, imag, complex
isFloatType       // real, imag -- is this a good name for such a query?

// While there, add these meta-queries.

isType    // any type
isValue   // any value, including param values
isParam   // a param value


Most of the above queries are already implemented. My proposal is about 
their names and making them part of the standard library.


PART 2: A related question is: do we want to have "Type" in those 
functions' names? For example:


Option 1:

// is 'arg' a range type? an error if invoked on a value
proc isRangeType(type arg) ...

// is 'arg' a range value? an error if invoked on a type
proc isRange(arg) ...

Option 2:

// is 'arg' a range type or a range value? returns false if neither
// ok to invoke on a value or on a type
proc isRange(type arg) ...
proc isRange(arg) ...


Considerations/votes in favor of one or the other? Assume that this 
principle will be applied to all is...Type functions above.


PART 3: I will also rename proc _isPrimitiveType -> proc 
chpl_isCertainSimpleType, unless there are objections. This is to avoid 
ambiguity - technically it is not checking whether the argument is a 
primitive type, in the Chapel sense of "primitive".


Vass

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to