Re: "OF" in types...
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jun 02, 2004
- 503 views
On Thu, 03 Jun 2004 08:23:18 +1000, Patrick Barnes <mistertrik at hotmail.com> wrote: >Any comments on this yet? >------------------------------------------------------------------------ >magnae clunes mihi placent, nec possum de hac re mentiri. Martin Clunes ate my placenta, therefore I became retarded? >------------------------------------------------------------------------ >>http://users.secsme.org.au/~prbarnes/misc/oth/type_of.txt <-- Draft spec >>Please comment. >The 'of' declaration is ONLY allowed within a type declaration, Any particular reason why? type x(sequence of z) return 1 end type On a previous post you said that a simple return 1 could be ignored. That would make x y and sequence of z y exactly the same. 4/4a. I think you are on the right path there, needs a bit more clarification, and dare I suggest examples of good and invalid? It shouldn't be "disallow"; it should issue warnings (unless without warning is in force around the type definition) and not be "fast" type checking. 5.2 if assigned to a literal and {}. You are wrong there. a literal is an object, it always needs full type checking (and it is often more important than run-time type checking, to make sure you start off on the right foot). 5.3 Ditto, functions only ever return an object. Of course a function can return anything, you can easily write a function that (randomly) returns an integer, float, or a sequence: you just *have* to treat function returns as type object, life gets too difficult otherwise. 5.4 not a logical operation but a concat()? 6. I retract this. There is no way to make badly written types fast. Instead, I want to be told how to write fast type checking. You can, of course (by enclosing in "without warning") still write slow type checking, I want to know how to write type checking which can be left on in production code, ie that does not kill performance. Eg a type which maintains a sum is "badly written". 7. Derek quashed this? I am slightly worried you are overly concerned with checking the "base", in my mind checking fewer elements is the key? The more I think on this, everything should be done _via_ the base, just passing the minimum number of elements... Also, for nested types, and subscript assignments, invoking the type checking "at the right level and no higher". Pete