HuubGitHub / dwscript

Automatically exported from code.google.com/p/dwscript
1 stars 0 forks source link

Add support for "set of" syntax #107

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
or at least a workaround to declare functions such as "StringReplace"

Original issue reported on code.google.com by tetra...@gmail.com on 12 Jun 2011 at 5:21

GoogleCodeExporter commented 8 years ago
One possible workaround until the support is added is to use bitwise values, 
and composite & test them with bitwise operators (and & or).

Original comment by zar...@gmail.com on 14 Jun 2011 at 7:36

GoogleCodeExporter commented 8 years ago
Raised priority a notch, might get in a generalized fashion (you could have set 
of anything), as a special form of arrays where items must be unique.
Special optimizations could be used to speedup the "set of enumeration" case.

Original comment by zar...@gmail.com on 12 Sep 2011 at 11:41

GoogleCodeExporter commented 8 years ago

Original comment by zar...@gmail.com on 12 Sep 2011 at 11:41

GoogleCodeExporter commented 8 years ago
Basic tests for correct set functionality.  This tests correct implementation 
of:
 - Include
 - Exclude
 - the +, - and * set operators
 - both styles of "set of" syntax
 - the compiler's ability to assign the empty set constant [] to multiple set types, and not confuse it with the empty array constant.
 - the compiler's ability to type-infer the type of a set constant, when the set type is declared in an unambiguous style such that the constant cannot be confused with an array constant.

It assumes a compiler magic function called "SetToString" exists that takes a 
set of any type and returns its canonical representation, with all elements 
present in the set enumerated from lowest ordinal value to highest ordinal 
value, in a comma-separated list between square brackets.

Original comment by masonwhe...@gmail.com on 25 Nov 2012 at 8:52

Attachments:

GoogleCodeExporter commented 8 years ago
Initial support added, limited to declaring "set of TSomeEnumType", 
Include/Exclude (as function or method) and the "in" operator.

Simpler (more focused) tests could be useful, as well as more focused tests for 
edge cases welcome! (see initial batch of tests)

Original comment by zar...@gmail.com on 30 May 2013 at 6:45

GoogleCodeExporter commented 8 years ago
Are you also going to add support for equality '=' and inequality '<>' on sets?
Also some other compiler magic functions would be nice
=============================================================================
Operator|Operation   |Compiler Magic  |Operand Types|Result Type|Example
        |            |Names suggest.  |             |           |    
=============================================================================
+        union        Union            set           set         Set1 + Set2
-        difference   Difference       set           set         S - T
*        intersection Intersection     set           set         S * T
<=       subset       SubsetOf         set           Boolean     Q <= MySet
>=       superset     SupersetOf       set           Boolean     S1 >= S2
=        equality     Equals           set           Boolean     S2 = MySet
<>       inequality   DoesNotEqual     set           Boolean     MySet <> S1
in       membership   In               ordinal, set  Boolean     A in Set1

Original comment by xsint...@gmail.com on 17 Sep 2013 at 7:29