[julia-users] Re: ANN: DelegationMacros v0.0.3

2016-09-06 Thread Jeffrey Sarnoff
Hi Lyndon,

The kind words are much welcome.
This, DelegationMacros, is the nicer -- more humanly -- phrasing of some of 
the macros in the earlier version.  
I expect to port some more of that version to the nicer style.  Please let 
me know if you need some combination of
number of fields to delegate into/through and count of variables to operate 
over.  I'd be happy to supply that with this.

-- Jeffrey


On Tuesday, September 6, 2016 at 9:56:31 PM UTC-4, Lyndon White wrote:
>
> Nice work.
> I spotted https://github.com/Jeffrey-Sarnoff/Delegate.jl
> last week and was pretty keen on it.
> Yet to use it but really looks like it will
> solve a lot of my irritation with Composition as a Inheritance.
>
> What is the relationship between Delegate.jl and DelegateMacros.jl?
> Is Delegate.jl deprecated?
> Is there non-overlapping features
>
>
> On Wednesday, 7 September 2016 06:14:22 UTC+8, Jeffrey Sarnoff wrote:
>>
>> This offers updated macros to assist with delegating into/through fields 
>> of a defined type.  
>>
>> Two macros apply a function to field value(s) yielding the functional 
>> result; 
>> and two others do that and then rewrap the result in the source type.
>>
>> The exports are:
>>@delegate_oneField, 
>>@delegate_oneField_fromTwoVars,
>>@delegate_oneField_asType, 
>>@delegate_oneField_fromTwoVars_asType
>>
>> They work so:
>>
>> import Base:string, show, (<), (<=), abs, (-), (+), (*)
>>
>> immutable MyInt16
>>value::Int16
>> end
>>
>> three = MyInt16(3)
>> seven = MyInt16(7)
>>
>>
>> @delegate_oneField( MyInt16, value, [string, show])
>>
>> string(three) == "3"  # true
>> show(seven)   # 7
>>
>>
>> @delegate_oneField_fromTwoVars( MyInt16, value, [ (<), (<=) ] )
>>
>> three <  seven# true
>> seven <= seven# true
>>
>>
>> @delegate_oneField_asType( MyInt16, value, [abs, (-)])
>>
>> abs(three) == three   # true
>> -seven == MyInt16(-7) # true
>>
>>
>> @delegate_oneField_fromTwoVars_asType( MyInt16, value, [ (+), (*) ] )
>>
>> three + seven == MyInt16(3+7) # true
>> three * seven == MyInt16(3*7) # true
>>
>>
>>
>>
>>
>>

[julia-users] Re: ANN: DelegationMacros v0.0.3

2016-09-06 Thread Lyndon White
Nice work.
I spotted https://github.com/Jeffrey-Sarnoff/Delegate.jl
last week and was pretty keen on it.
Yet to use it but really looks like it will
solve a lot of my irritation with Composition as a Inheritance.

What is the relationship between Delegate.jl and DelegateMacros.jl?
Is Delegate.jl deprecated?
Is there non-overlapping features


On Wednesday, 7 September 2016 06:14:22 UTC+8, Jeffrey Sarnoff wrote:
>
> This offers updated macros to assist with delegating into/through fields 
> of a defined type.  
>
> Two macros apply a function to field value(s) yielding the functional 
> result; 
> and two others do that and then rewrap the result in the source type.
>
> The exports are:
>@delegate_oneField, 
>@delegate_oneField_fromTwoVars,
>@delegate_oneField_asType, 
>@delegate_oneField_fromTwoVars_asType
>
> They work so:
>
> import Base:string, show, (<), (<=), abs, (-), (+), (*)
>
> immutable MyInt16
>value::Int16
> end
>
> three = MyInt16(3)
> seven = MyInt16(7)
>
>
> @delegate_oneField( MyInt16, value, [string, show])
>
> string(three) == "3"  # true
> show(seven)   # 7
>
>
> @delegate_oneField_fromTwoVars( MyInt16, value, [ (<), (<=) ] )
>
> three <  seven# true
> seven <= seven# true
>
>
> @delegate_oneField_asType( MyInt16, value, [abs, (-)])
>
> abs(three) == three   # true
> -seven == MyInt16(-7) # true
>
>
> @delegate_oneField_fromTwoVars_asType( MyInt16, value, [ (+), (*) ] )
>
> three + seven == MyInt16(3+7) # true
> three * seven == MyInt16(3*7) # true
>
>
>
>
>
>

[julia-users] Re: ANN: DelegationMacros v0.0.3

2016-09-06 Thread Jeffrey Sarnoff
to get the package, clone this 
git://github.com/JuliaArbTypes/DelegationMacros.jl.git 



On Tuesday, September 6, 2016 at 6:14:22 PM UTC-4, Jeffrey Sarnoff wrote:
>
> This offers updated macros to assist with delegating into/through fields 
> of a defined type.  
>
> Two macros apply a function to field value(s) yielding the functional 
> result; 
> and two others do that and then rewrap the result in the source type.
>
> The exports are:
>@delegate_oneField, 
>@delegate_oneField_fromTwoVars,
>@delegate_oneField_asType, 
>@delegate_oneField_fromTwoVars_asType
>
> They work so:
>
> import Base:string, show, (<), (<=), abs, (-), (+), (*)
>
> immutable MyInt16
>value::Int16
> end
>
> three = MyInt16(3)
> seven = MyInt16(7)
>
>
> @delegate_oneField( MyInt16, value, [string, show])
>
> string(three) == "3"  # true
> show(seven)   # 7
>
>
> @delegate_oneField_fromTwoVars( MyInt16, value, [ (<), (<=) ] )
>
> three <  seven# true
> seven <= seven# true
>
>
> @delegate_oneField_asType( MyInt16, value, [abs, (-)])
>
> abs(three) == three   # true
> -seven == MyInt16(-7) # true
>
>
> @delegate_oneField_fromTwoVars_asType( MyInt16, value, [ (+), (*) ] )
>
> three + seven == MyInt16(3+7) # true
> three * seven == MyInt16(3*7) # true
>
>
>
>
>
>