Boost logo

Boost :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2005-02-01 23:00:10


Jonathan Turkanis wrote:
> Matthew Vogt wrote:
>
>>Anyhow, my problem with the macro-based IDL is that it obscures the
>>function signatures so badly, partly by separating the components so I
>>don't recognise them as a signature, and partly by encasing them in a
>>dense text block.
>>
>>I think that this:
>>
>>BOOST_IDL_BEGIN(Interface)
>> BOOST_IDL_CONST_FN2(print, void, ostream&, int)
>>BOOST_IDL_END(Interface)
>>
>>is readability-wise so far away from:
>>
>>struct Interface
>>{
>> void print(ostream&, int) const;
>>};
>>
>>that it is an enormous hurdle for BIL to overcome.
>
> I'm sympathetic to this point of view. The reason it doesn't seem so bad to me
> is that only a relatively small part of coding with BIL is actually defining
> interfaces; the code which uses the interfaces is just ordinary C++.
>
> Do you have any suggestions for improving the macro syntax? For instance, do you
> like David Abrahams's suggested syntax better:
>
> DECLARE_INTERFACE(
> Interface,
> ((int)(print)(ostream&)(int))
> );
>
> ?
>
> (I'm not sure where to stick 'const')

Or the one I use for my project...

INHERITED(INTERFACE(DataTransferEvent),Event)
        ENUM(DataTransferEventType)
                NAME(Type VALUE(0x003))
        ENUM_CLOSE
        ENUM(Request)
                NAME(DataExtent)
                NAME(Data)
                NAME(Complete)
        ENUM_CLOSE
        METHOD(DataTransferEvent::Request,getRequest,ARGS0,throw())
        VOID_METHOD(getRequestData,ARGS2(UInt64&,UInt64&),throw())
        VOID_METHOD(readDataExtent,ARGS1(UInt64&),throw())
        VOID_METHOD(readData,ARGS3(UInt64&,UInt64&,Pointer&),throw())
        METHOD(bool,isComplete,ARGS0,throw())
        VOID_METHOD(setDataExtent,ARGS1(UInt64),throw())
        VOID_METHOD(setData,ARGS3(UInt64,UInt64,Pointer),throw())
        VOID_METHOD(setComplete,ARGS0,throw())
INTERFACE_CLOSE
INTERFACE(Exception)
        METHOD(UString,getMessage,ARGS0,throw())
        METHOD(UString,getDescription,ARGS0,throw())
        DECLARE_NESTED(INTERFACE(PreconditionViolation))
        DECLARE_NESTED(INTERFACE(InvalidArgument))
        DECLARE_NESTED(INTERFACE(InvalidResult))
INTERFACE_CLOSE

(and many more.. documentation comments and whitespace elided)

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk