On 8/8/14, 12:10 PM, Victor Porton wrote:
> I am writing thick Ada bindings for Raptor.
> 
> Now I work on binding this function:
> 
> raptor_term *       raptor_new_term_from_blank          (raptor_world *world,
>                                                          const unsigned char 
> *blank);
> 
> The documentation says that its behavior changes when `blank == NULL`.

I can make it also accept blank="" as the same as NULL in the code since
it's meaningless as a blank node ID.

> 
> But there is no concept of NULL string in Ada (unless using specific Ada 
> features to interoperate with C, which should not be used in a pure Ada 
> program).
> 
> There is certainly empty strings in Ada, but these are not the same as NULL C 
> strings.
> 
> As such I propose to make two Ada functions which call 
> raptor_new_term_from_blank (or raptor_new_term_from_counted_blank for better 
> performance):
> 
> One Ada function would accept a string which (after conversion to C string) 
> would be passed to raptor_new_term_from_blank.

Sure

> 
> The other Ada function would not accept a string but call 
> raptor_new_term_from_blank with `blank` set to NULL.
> 

Sure

> I think it (to make two Ada functions, which by the way can have the same 
> name and differ only in arguments) is a good approach for this problem.
> 
> However, I doubt because the C library writers decided to make one 
> raptor_new_term_from_blank function, not two functions for `blank != NULL` 
> and `blank == NULL`. I suspect that this design decision was taken not 
> without reason. So I doubt whether I should deviate from this design in Ada 
> bindings.
> 
> So: Should I make one or two functions for this?

Sounds good to me.

Dave


_______________________________________________
redland-dev mailing list
[email protected]
http://lists.librdf.org/mailman/listinfo/redland-dev

Reply via email to