[cairo] line_blah() APIs

Carl Worth cworth at cworth.org
Wed Jan 10 08:44:49 PST 2007

On Tue, 2 Jan 2007 13:21:06 -0800, Travis Griggs wrote:
> In the binding I've been creating, I of course have been as faithful
> as possible to provide method names similar to the original cairo
> function interface.

That's very kind of you, (and I know this can be quite challenging
when providing bindings to a language that's significantly less
imperative than C).

> But yesterday, I added a alternate set of calls for things like
> line_cap, line_width, and line_join. If you read the docs on those,
> they all point out that they affect stroking. So I've added alternate
> APIs called stroke_cap, stroke_width, stroke_join. Probably not worth
> changing the official Cairo API's for these. But I thought I'd pass
> it on. It seems to tell a more consistent story to me.

That probably would have been an improvement to make in cairo naming
in the first place. So, in the abstract, I agree with you.

But I'd actually advise you to resist the temptation to make tweaks
like this to "improve" cairo's naming. My reasoning is that I really
want the "cairo knowledge" that users acquire to be portable across
all the various language bindings. This makes it easier for people to
switch between languages or for people using two different language
bindings to more easily communicate and help each other.

I noticed a similar point in your blog posting, (smalltalk akamaru
looks really cool, by the way!):


There you talked about your creative solution for providing constants
such as:


I like the idea you came up with, but I think the naming is
wrong. What you have is:

	"a CapStyle class which you can send, butt, round, or square to"

For consistency, I'd much rather see that as:

	"a LineCap class which you can send, butt, round, or square to"

Anyway, that's the advice I have. It's your language binding though,
so it's all your own choices to make.

Oh, and, I'm sure you're aware of it, but for completeness I should
mention the cairo bindings' guide which covers a lot of these issues:


If your experience with writing a new set of bindings for cairo raised
any new questions that aren't answered in that document, I'd love to
see them so that we can improve it.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070110/eba43acf/attachment.pgp

More information about the cairo mailing list