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

show warning message if copy-tree with non list #476

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

knorth55
Copy link
Contributor

show warning message when copy-tree is used with non list object

1.irteusgl$ (setq a  (float-vector 1 2 3))
#f(1.0 2.0 3.0)
2.irteusgl$ (setq c (copy-tree a))
copy-tree should be used with list: #f(1.0 2.0 3.0)
#f(1.0 2.0 3.0)
3.irteusgl$ (setq b (list 1 2 3))
(1 2 3)
4.irteusgl$ (copy-tree b)
(1 2 3)

related #475

@Affonso-Gui
Copy link
Member

I am reluctant to giving this a thumbs up before having any way to suppress those warnings, since I believe that a language that emits lots of unwanted warnings is as annoying as one that emits none (personal preference at stake).

If actually solving the problem through reimplementation is not an option due to backwards compatibility, I would personally prefer to just update the jmanual entry and accept it as it is.

@knorth55
Copy link
Contributor Author

knorth55 commented Dec 15, 2021

  • Update manual and jmanual
    • We should do it
  • Show warning
    • Some user doesn't want it
    • Just for debugging mode?
  • Raise error
    • We should not do it?
    • Backward compatibility break?

@Affonso-Gui
Copy link
Member

I agree.

Just for debugging mode?

Printing warnings only when *debug* is true would be an option, but I honestly don't think that this feature is widespread enough for being any beneficial in this case.

Raise error

I was actually considering also returning a clone for other types of sequences as well.
This would also not be backwards-compatible, but I believe (without any evidence) that it might work just fine for our code base.

@Affonso-Gui
Copy link
Member

@knorth55 Since we are here please also mention that copy-seq is for shallow copies and copy-object is for deep copies.

The copy-seq documentation, just for reference:

NAME
     copy-seq
TYPE
     function
SYNOPSIS
     copy-seq sequence 
DESCRIPTION
     does shallow-copying of sequence, that is,  only the top-level references in sequence are copied.
     Use copy-tree to copy a nested list, or copy-object for deep-copying of a sequence containing recursive references. 

@k-okada
Copy link
Member

k-okada commented Dec 15, 2021

Thank you for contributing EusLisp documentation

Please check latest documents before merging

PDF version of English manual: manual.pdf
PDF version of Japanese jmanual: jmanual.pdf
HTML version of English manual: manual.html
HTML version of Japanese manual: jmanual.html
Sphinx (ReST) version of English manual: manual.rst

@k-okada
Copy link
Member

k-okada commented Dec 15, 2021

Thank you for contributing EusLisp documentation

Please check latest documents before merging

PDF version of English manual: manual.pdf
PDF version of Japanese jmanual: jmanual.pdf
HTML version of English manual: manual.html
HTML version of Japanese manual: jmanual.html
Sphinx (ReST) version of English manual: manual.rst

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

Successfully merging this pull request may close these issues.

3 participants