Skip to content

Conversation

@aradi
Copy link
Owner

@aradi aradi commented Jun 24, 2025

The --define-mode option controls, whether values in -D options are evaluated or treated as string literals. The -S (set) option initializes variables with expression evaluation (independent of the --define-mode settings).

Closes #32

The --define-mode option controls, whether values in -D options are
evaluated or treated as string literals. The -S (set) option
initializes variables with expression evaluation (independent of the
--define-mode settings).
@zerothi
Copy link

zerothi commented Jun 25, 2025

Thanks for this!

Some comments:

  • I still read -S as --string, but I might be biased from the prior discussion.
  • With this, I would argue one should have both the string-literal option, and the expression-literal option.

Effectively I would go for:

  • -E/--define-eval VAR=value
  • -S/--define-string VAR=value
  • -D/--define VAR=value (follows --define-mode)

In this way, you will always have the full control, while one could do with 1 less option. But I think -S for --set is a bit ambiguous in terms of what set means. Eval is much clearer IMHO. So if you don't want 3 options, I would go for -D and -E (--define-eval).

@aradi
Copy link
Owner Author

aradi commented Jun 27, 2025

@zerothi Thanks for your insights. I see the point. I have updated the PR accordingly. I'll still digest it a bit before merging, but I think, that's the most consistent solution, indeed.

@aradi aradi force-pushed the string-define branch 2 times, most recently from d9ca931 to f58ef61 Compare June 27, 2025 16:51
Behavior of -D is configurable via --define-mode, behavior of -S and
-E is fixed (string literal versus expression evaluation).
@aradi aradi merged commit d916eb4 into main Jul 17, 2025
@aradi aradi deleted the string-define branch July 17, 2025 12:32
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.

fypp with pypy throwing a FyppFatalError/NameError

3 participants