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

Allow tuning delegated arguments (i.e. exclude some, change defaulting mode...) #71

Closed
hkoba opened this issue Feb 22, 2016 · 0 comments

Comments

@hkoba
Copy link
Owner

hkoba commented Feb 22, 2016

In yatt widget declaration, an argument can be declared as a delegate type like following:

<!yatt:widget foo
    list=[delegate:mylist]
    label=[delegate]  
>

Above means a declaration of new widget foo, which has two delegate type arguments list and label. With these delegate type, the widget 'foo' will get

  1. All arguments from another widgets mylist and label (except previously declared same name arguments, which are just ignored).
  2. pseudo widget list and label becomes usable in definition scope of this 'foo' widget. When mylist is called, all arguments imported to the widget 'foo' (except explicitly specified in argument list of 'list' call) are automatically passed through to the real call of mylist too. (Same rule applies to label too.).

This automatic argument passing is quite useful to reduce copying argument declaration list from widget to widget. But there was one annoying conflict with another yatt feature: argument defaulting mode !(means required). For example, imagine above mylist is declared with required argument id like following:

<!yatt:widget mylist id=! file style>

In this case, argument 'id' becomes required argument of 'foo' too, even if you explicitly give
the argument 'id' to the call of pseudo widget list. This is quite messy.

So, I decided to add two more features for delegate type.

  1. If delegate type declaration has an argument list (like [delegate foo bar]), each specified spec overrides original definition of same name argument.
  2. If given name in delegate argument list starts with hyphen (like [delegate -foo]), specified argument is not imported at all.

With this new feature, you can rewrite our problem like following:

<!yatt:widget foo
    list=[delegate:mylist  -id]

You can change defaulting mode/default value too like following:

<!yatt:widget foo
    list=[delegate:mylist  id="?foo"]
@hkoba hkoba changed the title Allow changing defaulting mode of type(delegate) arguments Allow tuning delegated arguments (i.e. exclude some, change defaulting mode...) Feb 22, 2016
hkoba added a commit that referenced this issue Feb 22, 2016
* -excluded_var in delegate argument is supported.
@hkoba hkoba closed this as completed Oct 23, 2016
hkoba added a commit that referenced this issue Jun 17, 2017
Changelog diff is:

diff --git a/Changes b/Changes
index 0f97f43..5b253f2 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,46 @@
 Revision history for YATT::Lite

+0.101_001 2017-06-17
+    * (Possibly breaking) API changes
+         - [GH #84] Now yatt:args "/URL/{PATTERN}" is tested in written order.
+         - [GH #64] Use c3 mro for widget search by default.
+
+    * New/changed YATT Declarations
+         - [GH #54] <!yatt:base "file_or_directory">
+         - [GH #14] <!yatt:action "/URL/{PATTERN}">
+
+    * New/changed YATT Entities
+         - [GH #92] &yatt:script_name(); now respects Apache's Action+AddHandler
+         - [GH #74] &yatt:param(); is now equiv of &yatt:CON:param();.
+         - [GH #73] &yatt:coalesce(); now behaves like SQL's coalesce().
+         - [GH #70] &yatt:file_location(); and &yatt:is_current_page(page)
+
+    * Enhancement
+         - [GH #91] Better error reporting for XHF parser
+         - [GH #82] Add support for bufferedstreaming in raised response.
+         - [GH #80] Allow declaring types for routed args
+         - [GH #79] Site-wide special_entities
+         - [GH #71] Now delegate type can have argument list.
+         - [GH #69] YATT::Lite::Macro is now visible from subclasses.
+         - [GH #63] `Action NAME => SUB` support in `.htyattrc.pl`
+
+    * Miscellaneous helper functions.
+         - [GH #94] YATT::Lite::XHF->read_all()
+         - [GH #90] WebMVC0::Connection->delete_param
+         - [GH #82] Lite::Connection->raise_response($psgi_response).
+         - [GH #68] YATT::Lite::Factory->wrapped_by($outer_app) for Plack::Middleware.
+
+    * Bug fixes
+         - [GH #93] yatt:action arg detection should care DOS crlf too.
+         - [GH #83] Fix for bug "Safety level may not be changed inside a transaction"
+         - [GH #77] :CON:mkquery() now encode utf8 correctly.
+         - [GH #76] yatt:my code works for wide chars.
+         - [GH #75] Avoid use of error.ytmpl until code-generator becomes ready.
+         - [GH #74] Now yatt.render sets :CON:param() too.
+         - [GH #72] BUG: "Inconsistent hierarchy during C3 merge" occurs for complex inheritance.
+         - [GH #61] Adapt sprintf redundant arg warnings(5.22)
+
+
 0.101     2016-05-24
     * Just tagged 0.101 (from 0.100_003)
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

No branches or pull requests

1 participant