[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-12 Thread Andre Roberge
On Wed, Jun 12, 2019 at 7:56 PM Yanghao Hua wrote: > On Wed, Jun 12, 2019 at 11:27 PM Chris Angelico wrote: > > Yes, you would need some sort of syntactic parser. There are a couple > > of ways to go about it. One is to make use of Python's own tools, like > > the ast module; the other is to

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-12 Thread Caleb Donovick
Barry the reason I use python and don't parse syntax directly as I want to have python as meta programming environment for my DSLs. I can mostly work within the python syntax (with some pretty heavy metaclasses) I rarely have to touch the AST. Their only two places where I ever have to touch the

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-12 Thread Yanghao Hua
On Thu, Jun 13, 2019 at 12:52 AM Yanghao Hua wrote: > > On Wed, Jun 12, 2019 at 11:27 PM Chris Angelico wrote: > > Yes, you would need some sort of syntactic parser. There are a couple > > of ways to go about it. One is to make use of Python's own tools, like > > the ast module; the other is to

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-12 Thread Yanghao Hua
On Wed, Jun 12, 2019 at 11:27 PM Chris Angelico wrote: > Yes, you would need some sort of syntactic parser. There are a couple > of ways to go about it. One is to make use of Python's own tools, like > the ast module; the other is to mandate that your specific syntax be > "tidier" than the rest

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-12 Thread Chris Angelico
On Thu, Jun 13, 2019 at 6:51 AM Yanghao Hua wrote: > > On Wed, Jun 12, 2019 at 9:39 AM Chris Angelico wrote: > > If Python is really THAT close, then devise two syntaxes: an abstract > > syntax for your actual source code, and then a concrete syntax that > > can be executed. It's okay for things

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-12 Thread Yanghao Hua
On Wed, Jun 12, 2019 at 10:10 AM Greg Ewing wrote: > > Yanghao Hua wrote: > > You are absolutely right in that writing a new parser > > might not be a bad idea, but it is just s close for enabling > > Python to be used as the DSL language. > > You seem to be arguing for this as an enabler for

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-12 Thread Yanghao Hua
On Wed, Jun 12, 2019 at 9:39 AM Chris Angelico wrote: > If Python is really THAT close, then devise two syntaxes: an abstract > syntax for your actual source code, and then a concrete syntax that > can be executed. It's okay for things to be a little bit ugly (like > "signal[:] = 42") in the

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-12 Thread Greg Ewing
Yanghao Hua wrote: You are absolutely right in that writing a new parser might not be a bad idea, but it is just s close for enabling Python to be used as the DSL language. You seem to be arguing for this as an enabler for using Python for DSLs in general, but you're really only talking

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-12 Thread Chris Angelico
On Wed, Jun 12, 2019 at 5:26 PM Yanghao Hua wrote: > > On Tue, Jun 11, 2019 at 11:35 PM Barry Scott wrote: > > Some times a DSL is usable within the python syntax and that is great. > > I have use python for a number of DSL's. > > > > But when the DSL is beyond what python can help with directly

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-12 Thread Yanghao Hua
On Tue, Jun 11, 2019 at 11:35 PM Barry Scott wrote: > Some times a DSL is usable within the python syntax and that is great. > I have use python for a number of DSL's. > > But when the DSL is beyond what python can help with directly I'm wondering > why you do not parse the DSL with python and