Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-23 Thread Jason Newton
Just trying and improve the state of the art. Yea maybe we have to add some tricks to separate the two grammar wise, so they can play together. Besides, I didn't start with that complexity, it evolved into seeing if that was a viable path forward. On Tue, Aug 23, 2016 at 5:15 AM, Alex S. wrote:

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-23 Thread Jason Newton
> > > I have another idea/iteration to run by you then. One of your chief > > quibbles, although I don't think it's your underlying one, is Cython must > > understand what's going on. So how about we support a block of C/C++ > code > > as a proper construct. Same name but now, I guess braces may

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-23 Thread Alex S.
Watching this thread for a long time now, and I must say I absolutely love how someone just barges in «oh just add parsing of C++ AST». C++ is a language with an extremely complex context-dependent grammar, much more so than C. Not to mention they took to updating the standard with new awesome f

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-22 Thread Robert Bradshaw
On Mon, Aug 22, 2016 at 9:44 PM, Robert Bradshaw wrote: > And it would be a step back > for the nice auto-conversion facilities you care about, e.g. > > py_func(c_func(py_value)) > > would become > > c_value = py_value > cdef some_type c_ret > inline_cpp "c_ret = c_func(c_value)"

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-22 Thread Robert Bradshaw
On Mon, Aug 22, 2016 at 4:48 PM, Jason Newton wrote: > > Bare in mind that was then, and while I'm not Cython developer level I do > have a better idea of how Cython works now, possibly better than your > average user. I've thought about this problem and the state of the overall > C++ python bind

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-22 Thread Jason Newton
On Mon, Aug 22, 2016 at 3:26 PM, Robert Bradshaw wrote: > > To clarify, I'm coming from the case where I > > didn't read the whole tutorial/docs before being faced with pyx in the > > projects I previously mentioned, while on tight turn around time - I was > not > > able to grok in that context.

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-22 Thread Robert Bradshaw
On Mon, Aug 22, 2016 at 7:44 AM, Kevin Thornton wrote: > I actually just realized another nagging issue with C++/Cython: member > typedefs are not supported: > > cdef vector[T]: > ctypedef size_t size_type > > These "scoped" typedefs are very widely-used. We can live without it, and > we ha

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-22 Thread Robert Bradshaw
On Sun, Aug 21, 2016 at 7:26 AM, Jason Newton wrote: > > On Sun, Aug 21, 2016 at 5:30 AM, Robert Bradshaw wrote: >> >> In my experience Cython has generally been fairly easy to pick up for >> people who already know Python. And Python often easy to pick up for >> people who already know C/C++. Of

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-22 Thread Kevin Thornton
I actually just realized another nagging issue with C++/Cython: member typedefs are not supported: cdef vector[T]: ctypedef size_t size_type These "scoped" typedefs are very widely-used. We can live without it, and we have been, but while we're making a list.. :) --Kevin On Sat, Aug 20,

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-22 Thread Kevin Thornton
On Sat, Aug 20, 2016 at 11:15 PM Robert Bradshaw wrote: > On Fri, Aug 19, 2016 at 9:34 AM, Kevin Thornton wrote: > > Hi Robert, > > > > Related to this point, I think there are three important features that > > Cython would benefit from, as far as C++11 and newer are concerned. In > > order of

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-22 Thread Kevin Thornton
On Sat, Aug 20, 2016 at 11:15 PM Robert Bradshaw wrote: > On Fri, Aug 19, 2016 at 9:34 AM, Kevin Thornton wrote: > > Hi Robert, > > > > Related to this point, I think there are three important features that > > Cython would benefit from, as far as C++11 and newer are concerned. In > > order of

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-21 Thread Greg Ewing
Robert Bradshaw wrote: Name mangling is done for the standard reasons--to avoid possible conflicts with all other symbols that may be defined. The main reason for mangling names is that top-level declarations in Cython belong to a module namespace, whereas C just has a single namespace for all

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-21 Thread Jason Newton
On Sun, Aug 21, 2016 at 5:30 AM, Robert Bradshaw wrote: > > In my experience Cython has generally been fairly easy to pick up for > people who already know Python. And Python often easy to pick up for > people who already know C/C++. Of course for many wrappings it often > takes non-trivial knowl

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-21 Thread Jason Newton
On Sun, Aug 21, 2016 at 1:36 AM, Ian Henriksen < insertinterestingnameh...@gmail.com> wrote: > >> Remember - cython is "the way" that comes up for how to glue C/C++ into >> python these days, not just the program in cish python frontend for speed. >> >> > There's some truth to the issues you raise

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-21 Thread Jason Newton
ctypes/cffi aren't in the same class for comparison. Just at the start of the list is basically a restriction from C++ name mangling fouling things up. Pybindgen uses a programmable model to generate bindings for existing functions/classes only. It's a fair bit different from anything I had in m

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-21 Thread Stefan Behnel
Robert Bradshaw schrieb am 21.08.2016 um 11:30: > You ask at the beginning of the email whether time has vindicated our > philosophy. I think, based on the mindshare vs. these other attempts > at integrating with C, in large part it has. It has served us and our > users well; we will strive to stay

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-21 Thread Stefan Behnel
Robert Bradshaw schrieb am 21.08.2016 um 11:11: > On Fri, Aug 19, 2016 at 12:32 PM, Jason Newton wrote: >> PyInline's last news update was in 2004 where the author gives a "Hats of[f] >> to PyRex", prior to that only a few blog entries in 2001/2002, I've not come >> across any project using it but

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-21 Thread Robert Bradshaw
On Fri, Aug 19, 2016 at 11:19 AM, Jason Newton wrote: > > On Fri, Aug 19, 2016 at 5:36 AM, Robert Bradshaw wrote: >> >> On Thu, Aug 18, 2016 at 12:05 PM, Jason Newton wrote: >> > Accidentally posted to an already-opened tab for the cython-users ML >> > yesterday, moving to here. Following up fro

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-21 Thread Robert Bradshaw
On Fri, Aug 19, 2016 at 12:32 PM, Jason Newton wrote: > > > On Fri, Aug 19, 2016 at 3:19 PM, William Stein wrote: >> >> On Fri, Aug 19, 2016 at 8:19 AM, Jason Newton wrote: >> > You must realize that almost any other python driven way to compile >> > c-code >> > in the spirit these projects do i

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-20 Thread Robert Bradshaw
On Fri, Aug 19, 2016 at 9:34 AM, Kevin Thornton wrote: > Hi Robert, > > Related to this point, I think there are three important features that > Cython would benefit from, as far as C++11 and newer are concerned. In > order of what I'm guessing to be increased complexity are: > > 1. Non-type temp

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-20 Thread Ian Henriksen
> > > Remember - cython is "the way" that comes up for how to glue C/C++ into > python these days, not just the program in cish python frontend for speed. > > There's some truth to the issues you raise, but there are a lot of nasty details behind the scenes. Do you have some more concrete details f

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-20 Thread Jason Newton
On Sat, Aug 20, 2016 at 1:19 AM, Stefan Behnel wrote: > > Especially with respect to C++, we've always tried to make things safe and > helpful that Cython can support directly, and to make things possible that > are too complex to handle safely. But I agree with Robert that allowing > arbitrary C

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-19 Thread Stefan Behnel
Robert Bradshaw schrieb am 19.08.2016 um 11:36: > On Thu, Aug 18, 2016 at 12:05 PM, Jason Newton wrote: >> I was hoping we could give a way to drop straight into C/C++ inside of >> Cython pyx files. >> >> Why? >> [...] >> -It works around having the Cython compiler know about all of C++'s nuances >

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-19 Thread Kevin Thornton
Hi Robert, Related to this point, I think there are three important features that Cython would benefit from, as far as C++11 and newer are concerned. In order of what I'm guessing to be increased complexity are: 1. Non-type template parameters. 2. "rvalue" references for standalone functions and

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-19 Thread Jason Newton
On Fri, Aug 19, 2016 at 3:19 PM, William Stein wrote: > On Fri, Aug 19, 2016 at 8:19 AM, Jason Newton wrote: > > You must realize that almost any other python driven way to compile > c-code > > in the spirit these projects do is deprecated/dead. Cython has absorbed > all > > the reputation and

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-19 Thread William Stein
On Fri, Aug 19, 2016 at 8:19 AM, Jason Newton wrote: > You must realize that almost any other python driven way to compile c-code > in the spirit these projects do is deprecated/dead. Cython has absorbed all > the reputation and users that didn't go to pure-c/boost.python - pybind11 is > the new

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-19 Thread Jason Newton
On Fri, Aug 19, 2016 at 5:36 AM, Robert Bradshaw wrote: > On Thu, Aug 18, 2016 at 12:05 PM, Jason Newton wrote: > > Accidentally posted to an already-opened tab for the cython-users ML > > yesterday, moving to here. Following up from a github opened issue here: > > > > https://github.com/cython/

Re: [Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-19 Thread Robert Bradshaw
On Thu, Aug 18, 2016 at 12:05 PM, Jason Newton wrote: > Accidentally posted to an already-opened tab for the cython-users ML > yesterday, moving to here. Following up from a github opened issue here: > > https://github.com/cython/cython/issues/1440 > > I was hoping we could give a way to drop stra

[Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

2016-08-18 Thread Jason Newton
Accidentally posted to an already-opened tab for the cython-users ML yesterday, moving to here. Following up from a github opened issue here: https://github.com/cython/cython/issues/1440 I was hoping we could give a way to drop straight into C/C++ inside of Cython pyx files. Why? -It [helps] av