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

Define globals as a function is parsed #548

Open
tavmem opened this issue Aug 6, 2019 · 1 comment
Open

Define globals as a function is parsed #548

tavmem opened this issue Aug 6, 2019 · 1 comment

Comments

@tavmem
Copy link
Collaborator

tavmem commented Aug 6, 2019

The k2.8 parser is recursive:
k2.8 defines globals that are contained in a function as the function is being parsed.
This may not be a bug in Kona, nor a critical difference between k and Kona,
but I thought it was worth documenting the difference.

$ rlwrap -n ./k
K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems
\ for help. \\ to exit.

  abc:{3+def(x)}
  \v
def abc 
  def 5
5
$ rlwrap -n ./k
kona      \ for help. \\ to exit.

  abc:{3+def(x)}
  \v
,`abc
  def 5
value error
def
^
@tavmem
Copy link
Collaborator Author

tavmem commented Aug 7, 2019

But, there are boundary cases were k2.8 and Kona both define a global contained in a function. Since "global assignment" (::) is not used, you might guess that "def" is local to the function "abc".

K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems
\ for help. \\ to exit.

  abc:{def,:2}
  \v
def abc 
  def
  abc 5
  def
(;2)
$ rlwrap -n ./k
kona      \ for help. \\ to exit.

  abc:{def,:2}
  \v
`abc `def
  def
  abc 5
(;2)             /note:  Kona displays a result here, where k2.8 does not
  def
(;2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant