Arc Forumnew | comments | leaders | submitlogin
2 points by nostrademons 6169 days ago | link | parent

I really like #4, but what other data types would it support? Arc doesn't currently have anything other than lists, hashtables, and primitives. Unless you mean specifying call and set operations for tagged data types...


3 points by vincenz 6169 days ago | link

You can define any type you want with 'annotate'.

For instance, if you look at arc.arc, you'll see the first two macros are defined without the use of the macro mac. Using

   (set foo (annotate 'mac some-function))
This sets the type to a 'mac (or macro :)

So yes, I guess I do mean for tagged data-types, but also for any possible future 'native' types that it will come to support. Or even redefining it within the context of your application.

-----

2 points by nex3 6169 days ago | link

The way I solved this in the Wiki was to give tagged values (except macros) the same calling semantics as their non-tagged equivalents. Thus, you can represent arbitrary datatypes as functions, tagging them to keep track of their type but still calling them.

-----

4 points by vincenz 6169 days ago | link

That's completely the opposite of what I want :)

I want:

    a) The ability to define within arc what happens when a list is 
         used as function, instead of it being predefined in scheme
    b) The ability to do this for any type and custom types.
 
And potentially:

    c) For annotated values to be able to do this per-object, 
        by storing an extra field in there that is the getter, 
        where the default value is the one for the type.

    E.g:  (annotate 'blabla value getter)
If there is no getter, then use the one for type 'blabla

-----