emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Using a display_info union instead of a typedef Display_Info


From: Daniel Colascione
Subject: Re: [RFC] Using a display_info union instead of a typedef Display_Info
Date: Fri, 12 Apr 2019 12:36:22 -0700
User-agent: SquirrelMail/1.4.23 [SVN]

>> From: Alex Gramiak <address@hidden>
>> Cc: address@hidden,  address@hidden
>> Date: Fri, 12 Apr 2019 12:40:45 -0600
>>
>> > Looks to me like replacing one set of window-system specific code with
>> > another: still the same #ifdef's and the same window-system specific
>> > code fragments.  Maybe I'm missing something, but it doesn't look to
>> > me like a change for the better.
>>
>> There will always have to be window-system specific code somewhere. The
>> difference with this patch is that the changed parts of the code will be
>> able to be used by multiple different window systems. That is to say, I
>> believe this is a necessary step towards Stefan's goal of using multiple
>> window systems simultaneously.
>>
>> Note how before there was the implicit conditional compilation regarding
>> the definition of check_x_display_info and x_get_arg that allowed the
>> procedure to be used by _only_ 1 window system, but decode_display_info
>> and gui_display_get_arg would be able to handle _all_ graphical window
>> systems that Emacs is built with.
>>
>> This currently doesn't mean any functional change as that number can
>> currently only be 1, but it would be nice for that to change. Again, I
>> believe this is (part of) the way to do so.
>
> We've been through this before: if these changes don't come together
> with, or closely followed by, the code to support using several
> window-systems in the same session, I'd prefer not to make these
> changes at this time.  The advantages you describe are at this point
> theoretical, whereas the disadvantage -- making the code less familiar
> for veteran Emacs hackers -- is very real.
>
> Let's invest our time and energy in making changes that are useful
> today, not in some distant future.
>
>> To show how it's used, I've included a diff that uses
>> decode_display_info to simplify all 3 check_x_display_info
>> implementations into a single conditional. (I could remove that
>> conditional with another terminal hook, but I'm not sure that's worth
>> it).
>
> There's a way to attain that without the massive changes you propose:
> just make a single function which dispatches by the type of
> output_data.  We won't be able to judge which alternative is better
> until and unless we have real code which implements this feature.

The way Alex proposes to do it is the right one. You're proposing using
typecases everywhere, which ends up being unmaintainable. A set of
well-defined hooks that various implements can fill is a concept that's
used all over the place, from Linux file_operations structures to C++
vtables. The efficiency argument is bogus: processors will do jump target
prediction perfectly well, because everyone uses this indirect call
technique.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]