[Y-devel] Slider widget done
Andrew Suffield asuffield at debian.org
Wed Mar 10 18:11:22 GMT 2004
On Wed, Mar 10, 2004 at 06:19:23PM +0100, Jerome Laheurte wrote:
> On Wed, 10 Mar 2004, Andrew Suffield wrote:
>
> > On Mon, Mar 08, 2004 at 10:16:37PM +0100, Jerome Laheurte wrote:
>
> > > obj->foobar = "spam";
> >
> > ...I don't think it's a good idea to pretend that these things are
> > lvalues, because they aren't. Furthermore, you don't (can't) provide
> > the equivalent "read" behaviour in a sane way.
>
> Yes, I do. In most situations though, it requires an explicit cast,
> depending on the compiler's willingness, because it's obviously done
> using operator overloading, so it becomes something like
>
> printf("%s\n", (const char*)obj->text);
>
> (gcc will issue a warning without the cast, anyway)
Ye gads, that is totally not how you do a static cast in C++. But that
hardly matters; it's not a sane interface. That'll block for an entire
round-trip, which is no good.
> > > There's also a 'IntegerProperty' class, of course.
> >
> > Templates, damn you. That's what they're for.
>
> Well, I first tried with templates, but I let it go because I'm not
> aware of a way to specify a "transformation function" in a template
> (for instance, atol(3) in the case of integer properties).
Template specialisation. It's not exactly high-level stuff.
> I choose this approach instead of a more traditionnal get/set method
> pair because
>
> 1) I'm too used to Python :)
>
> 2) That's what's being done elsewhere (in Borland C++ Builder through
> proprietary extensions to C++, and in Qt 3.x through a method I don't
> know but which is probably very similar to mine).
Which might make sense if it were a get/set pair, but it isn't. Reads
are a two-step process. libYc++ does not pretend to be a remote object
system.
--
.''`. ** Debian GNU/Linux ** | Andrew Suffield
: :' : https://www.debian.org/ |
`. `' |
`- -><- |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://www.y-windows.org/pipermail/y-devel/attachments/20040310/3d24565e/attachment.bin
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved