Perhaps you should take a look at Dlang. Using opDispatch and a with statement 
and compile time code generation, you may be able to accomplish what you’re 
trying to do entirely in D.

> On May 24, 2019, at 4:05 AM, Yanghao Hua <yanghao...@gmail.com> wrote:
> 
>> On Fri, May 24, 2019 at 1:59 AM Steven D'Aprano <st...@pearwood.info> wrote:
>> 
>>> On Thu, May 23, 2019 at 06:23:31PM +0200, Yanghao Hua wrote:
>>> 
>>> Is this (<== and ==>) something can be made into CPython?
>> 
>> If it goes into CPython, eventually every other Python needs to do the
>> same.
>> 
>> Of course it *could* be put into Python, but you haven't given
>> sufficient justification for why it *should* be put into Python.
>> 
>> Why does your DSL need a seperate assignment operator? How is it
>> different from regular assignment?
>> 
>> Could you use __setitem__ instead?
>> 
>> Instead of this:
>> 
>>    variable <== thing  # magic happens here
>> 
>> can you write this?
>> 
>>    obj.variable = thing  # magic happens here
>> 
>> 
>> If your DSL is so different from Python that it needs new operators,
>> perhaps you should write an interpreter for your language and run that
>> seperately.
>> 
>>    code = """
>>    any syntax you like <- thing
>>    """
>>    result = interpret(code)
> 
> Well, if python is not envisioned to be able to represent almost
> everything elegantly maybe I should indeed walk away from this idea.
> (This is sad for me ... I have been saying and believing python is
> envisioned that way for more than 20 years now). Your argument could
> be applied on PEP465 as well, where the only justification is to make
> matrix operation prettier. I have explained the problem of use
> descriptors in previous replies, where you cannot have a local signal,
> e.g. obj.signal = thing # works, but local_signal = thing # doesn't
> work.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/5XE3WSGBJN6CTDNG55D3WUJD2BH2PUAC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to