-
Notifications
You must be signed in to change notification settings - Fork 51
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
eval to support math comparison #31
Comments
not sure what this would involve, but one feature that could fit in here is so e.g. this could be supported: if less_than (get_last_modified_time package.lock) (current_time)
echo hi
end |
you have calc + less/greater/eq commands. |
It might just be that I'm not very experienced with duckscript, but this got rather lengthy.
I would have prefered to be able to do something like this:
|
ya the conditions are a bit basic in their capabilities and duckscript in general has 1 command per 1 line rule. |
Makes sense. I just thought it might be a useful feature to basically have a shortcut to always needing to move everything in a variable. Fish follows a similar approach, wanting to have a simple syntax that prefers e.g. commands over language features, that's why I proposed their syntax. Thinking about it, maybe something more inline with the variable expansions It should also not increase the implementation complexity too much, as the implementation could basically be:
Probably makes not a lot of sense to actually implement it like that, but I would find it quite useful. |
can you explain a bit more? maybe put some small example? |
Basically my example from above. A bit simplified, this: if less_than $(get_last_modified_time file) $(calc $(current_time) - 100)
echo true
else
echo false
end Should internally expand to __get_last_modified_time = get_last_modified_time file
__current_time = current_time
__calc = calc ${__current_time} - 100
if less_than ${__get_last_modified_time} ${__calc}
echo true
else
echo false
end I used |
No description provided.
The text was updated successfully, but these errors were encountered: