[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Request for Comments: Support for C++ Scoped Enums
From:       Shaheed Haque <srhaque () theiet ! org>
Date:       2017-08-11 16:56:18
Message-ID: CAHAc2jeyHWLH6BTdscjF7Q3FWqxqhU_s_ehYHarHJ_hnGEAR2A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On 11 August 2017 at 16:22, Phil Thompson <phil@riverbankcomputing.com>
wrote:

> At the moment SIP only supports C-like unscoped enums and implements them
> as sub-classes of int. The main weaknesses of these are the lack of type
> safety and the injection of the member names into the enclosing scope.
>
> These problems were fixed by the introduction of scoped enums in newer
> versions of C++, see...
>
> https://www.ibm.com/developerworks/rational/library/scoped-enums/index.
> html
>
> Note that Qt doesn't currently use scoped enums but I expect that to
> change.
>
> Scoped enums are much closer to the implementation of Python enums...
>
> https://docs.python.org/3/library/enum.html#module-enum
>
> I propose to add support for scoped enums and implement them using Python
> enums - specifically as sub-classes of Enum (and *not* IntEnum in order to
> preserve the type safety). Consequently Python v3.4 or later will be
> required for wrapping libraries using scoped enums.
>
> Any comments welcome.
>
> Phil
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt


My present focus is on Python2.7, and though I am keen to move onto 3,
that's perhaps some weeks/months off. So, if there is some basic support
for 2, that would allow me to transition in my own time.

[Attachment #5 (text/html)]

<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 11 August \
2017 at 16:22, Phil Thompson <span dir="ltr">&lt;<a \
href="mailto:phil@riverbankcomputing.com" \
target="_blank">phil@riverbankcomputing.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">At the moment SIP only supports C-like unscoped enums and \
implements them as sub-classes of int. The main weaknesses of these are the lack of \
type safety and the injection of the member names into the enclosing scope.<br> <br>
These problems were fixed by the introduction of scoped enums in newer versions of \
C++, see...<br> <br>
<a href="https://www.ibm.com/developerworks/rational/library/scoped-enums/index.html" \
rel="noreferrer" target="_blank">https://www.ibm.com/<wbr>developerworks/rational/<wbr>library/scoped-enums/index.<wbr>html</a><br>
 <br>
Note that Qt doesn&#39;t currently use scoped enums but I expect that to change.<br>
<br>
Scoped enums are much closer to the implementation of Python enums...<br>
<br>
<a href="https://docs.python.org/3/library/enum.html#module-enum" rel="noreferrer" \
target="_blank">https://docs.python.org/3/<wbr>library/enum.html#module-enum</a><br> \
<br> I propose to add support for scoped enums and implement them using Python enums \
- specifically as sub-classes of Enum (and *not* IntEnum in order to preserve the \
type safety). Consequently Python v3.4 or later will be required for wrapping \
libraries using scoped enums.<br> <br>
Any comments welcome.<br>
<br>
Phil<br>
______________________________<wbr>_________________<br>
PyQt mailing list      <a \
href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br> <a \
href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" \
target="_blank">https://www.<wbr>riverbankcomputing.com/<wbr>mailman/listinfo/pyqt</a></blockquote></div><br></div><div \
class="gmail_extra">My present focus is on Python2.7, and though I am keen to move \
onto 3, that&#39;s perhaps some weeks/months off. So, if there is some basic support \
for 2, that would allow me to transition in my own time.<br></div><div \
class="gmail_extra"><br></div></div>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic