Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

igop: repl built-in functions design #528

Open
visualfc opened this issue Aug 5, 2020 · 0 comments
Open

igop: repl built-in functions design #528

visualfc opened this issue Aug 5, 2020 · 0 comments
Labels

Comments

@visualfc
Copy link
Member

visualfc commented Aug 5, 2020

igop repl add pythonic built-in functions . rtype eval ...

  • type

rtype(x interface{}) Type can be compared two Type

//rtypeMap = make(map[Type]reflect.Type)
type Type string
func (Type) Type() reflect.Type
func (Type) Kind() reflect.Kind
>>> rtype(100) == rtype(200)
true
>>> rtype(100) == "int"
true
  • eval

eavl(expr string) (interface{},error)

  similar igop
  copy current context vars to new context and run. 
  return context ret interface{}/[]interface{} , error
>>> a := 10
>>> eval("a+1")
11,nil
>>>
  • dir
    dir ?

  • vars
    vars?

@visualfc visualfc changed the title igop: repl add built-in functions igop: repl built-in functions design Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants