erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.62k stars 54 forks source link

feat(REPL): improve interactive experience #362

Closed C-BJ closed 1 year ago

C-BJ commented 1 year ago

Change

1.Fixes #216 (modify the tip of failed to dump a. pyc file) 2.Fixes #26 3.Fixes #62 4.Fixes #56 5.Support up key browsing history 6.Added the paste function for Windows, WSL, Linux(need to install xsel) and MacOS 7.Fixed countless crash bugs 8.improve the multi-line REPL operation 9.Improve REPL testing 10.add --features full 11.Update README

Direct dependent change

add optional crossterm = "0.25.0" to erg_common

mtshiba commented 1 year ago

:clear is already implemented.

https://github.com/erg-lang/erg/blob/ab1c45e7ec664d52ce4f831e3e17509b50240e99/crates/erg_common/traits.rs#L584

C-BJ commented 1 year ago

:clear is already implemented.

https://github.com/erg-lang/erg/blob/ab1c45e7ec664d52ce4f831e3e17509b50240e99/crates/erg_common/traits.rs#L584

sorry

C-BJ commented 1 year ago

It's so weird. I just run cargo fmt and CI fails Restore it and CI is successful again

@mtshiba

GreasySlug commented 1 year ago

Please squash commits that don't make much sense

C-BJ commented 1 year ago

Yes, In merge commit

C-BJ commented 1 year ago

Before this PR the Ubuntu CI also has a probability faild:https://github.com/erg-lang/erg/actions/runs/3984374464/jobs/6830520255

Local tests passed, but CI failed @mtshiba

mtshiba commented 1 year ago
>>> C = Class {x = Int}

>>> C.
...     method self = None
...
Error[#0126]: File <stdin>, line 1,

1 |
  : -
  : `- exists a similar name variable:

NameError: C is not defined

>>> @Inheritable
... D = Class {x = Int}
... D.
...     method self = None
...
...
>>>

This is not a mistake, but a request for improvement. If a class has a decorator, it is supposed to accept subsequent method definitions. I would like this to be the case even when decorators are not attached.

P.S.

>>> @id
... f x = x
...

The behavior seems to be that if a decorator is attached, the methods' definition is expected, but this behavior is not strictly correct, since non-classes can also have decorators. It would be necessary to determine the class definition. It would be difficult to implement in earnest, but as a simple implementation, if a Class is placed immediately after the =, it can be judged as a class definition.

C-BJ commented 1 year ago

I have found a problem that if you type anything other than English in the repl, there will be a lot of problems (I will solve this problem).

mtshiba commented 1 year ago

Decorators not working properly.

スクリーンショット_20230206_145017

mtshiba commented 1 year ago

Thank you so much!