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

ENH - make some of the code more robust for string input #2383

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

schoffelen
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Feb 1, 2024

You should test whether your modifications do not break anything.
See https://www.fieldtriptoolbox.org/development/testing/

When outside the DCCN, please consider testing: test_yorkinstruments, test_bug2511, test_bug2370, test_bug1818

When inside the DCCN, please also consider testing: test_bug2170, test_bug2511, test_bug3438, test_curry, test_bug1833, test_bug2419, test_bug1914, test_bug2888, test_pull1826, test_bug2385, test_pull2183, test_bug2232, test_fileformat_asa, test_bug3042, test_yorkinstruments, test_bug3027, test_issue1991, test_pull1248, test_bug1427, test_bug1924, test_bug1818, test_issue1992

Suggested tests outside the DCCN use public data or do not use data.
Suggested tests inside the DCCN use private data.

@schoffelen schoffelen linked an issue Feb 1, 2024 that may be closed by this pull request
@schoffelen
Copy link
Contributor Author

@robertoostenveld this fixes an old issue. I was wondering whether we should build an option into ft_checkconfig (by default to be 'no', which converts any strings into chars). This could be part of ft_default (e.g. ft_default.checkchar). I think that the overhead in ft_checkconfig would be minimal, and at least it captures all occurrences of "" in the cfg ' s

@robertoostenveld
Copy link
Contributor

do we have any use cases where we expect people to specify strings? I don't think so.

Why would the default for cfg.checkchar be 'no', would we not in general want to convert strings to chars?

And should it be checkchar or checkstring?

@schoffelen
Copy link
Contributor Author

do we have any use cases where we expect people to specify strings? I don't think so.

My expectations are not too high here. I think that @mjcourte used a string in the original issue report. Not sure whether current generations of Matlab users use strings and char intermixed.

Why would the default for cfg.checkchar be 'no', would we not in general want to convert strings to chars?

Well, I was thinking that it would create a little bit of extra overhead, but I don't mind defaulting to 'yes'

And should it be checkchar or checkstring?

Yes, well that's a good point. checkstring would be more appropriate

@robertoostenveld
Copy link
Contributor

Regarding enabling it by default: if it is not enabled by default, chances are very high that people will encounter the problem (when they specify a string as value) and not find the solution themselves. The documentation in ft_defaults is quite sparse, and when people call ft_whatever it is unlikely that they'll even consider the relevance of ft_defaults.

@schoffelen
Copy link
Contributor Author

Regarding enabling it by default: if it is not enabled by default, chances are very high that people will encounter the problem (when they specify a string as value) and not find the solution themselves. The documentation in ft_defaults is quite sparse, and when people call ft_whatever it is unlikely that they'll even consider the relevance of ft_defaults.

Yes, all good. Do I have permission to proceed? :)

@robertoostenveld
Copy link
Contributor

Yes, pleas go ahead!

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.

Windows 11 or >=R2021b file reading errors
2 participants