- From: <bugzilla@wiggum.w3.org>
- Date: Wed, 27 Jul 2005 13:05:13 +0000
- To: public-qt-comments@w3.org
- Cc:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=1583 simeon@us.ibm.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED ------- Additional Comments From simeon@us.ibm.com 2005-07-27 13:05 ------- Agreed, we may find a better way to write those rules. Here are some proposed rules to address the comment, trying to improve on the readability for the existing rules. - Jerome Notations --------- We should introduce a new formal grammar production: [Formal] FunctionSig ::= "declare" "function" QName "(" ParamList? (")" | (")" "as" SequenceType)) Such production is notably used in the static context (for statEnv.funcType). Dynamic semantics ----------------- Here is the generic rule function function calls: dynEnv |- Expr1 => Value1 ... dynEnv |- Exprn => Valuen statEnv |- QName of func expands to expanded-QName statEnv.funcType(expanded-QName) = { FunctionSig1, ..., FunctionSigm } FunctionSigi = declare function expanded-QName(Type1, ..., Typen) as Type statEnv |- Value1 against Type1 promotes to Value1' ... statEnv |- Valuen against Typen promotes to Valuen' dynEnv |- function expanded-QName with types (Type1,...,Typen) on values (Value1',...,Valuen') yields Value statEnv |- Value against Type promotes to Value' ------------------------------------------------------------------------------------------- dynEnv |- QName ( Expr1, ..., Exprn ) => Value' This uses the following auxiliary judgment: dynEnv |- function expanded-QName with types (Type1,...,Typen) on values (Value1',...,Valuen') yields Value which is defined as follows: * For user-defined functions: dynEnv.funcDefn(expanded-QName(Type1, ..., Typen)) = (Expr, Variable1, ... , Variablen) dynEnvDefault + varValue( Variable1 => Value1; ...; Variablen => Valuen) |- Expr => Value --------------------------------------------------------------------------------------------------------- dynEnv |- function expanded-QName with types (Type1,...,Typen) on values (Value1,...,Valuen) yields Value * For built-in or functions: dynEnv.funcDefn(expanded-QName(Type1, ..., Typen)) = #BUILT-IN "The built-in function" expanded-QName "(See [Functions and Operators] or [7 Additional Semantics of Functions]) applied to" (Value1,...Value2) "yields the value" Value --------------------------------------------------------------------------------------------------------- dynEnv |- function expanded-QName with types (Type1,...,Typen) on values (Value1,...,Valuen) yields Value * For external functions: dynEnv.funcDefn(expanded-QName(Type1, ..., Typen)) = #EXTERNAL "The external function" expanded-QName "applied to" (Value1,...Value2) "yields the value" Value --------------------------------------------------------------------------------------------------------- dynEnv |- function expanded-QName with types (Type1,...,Typen) on values (Value1,...,Valuen) yields Value * For imported functions: Note that this case also checks that the parameteres can be promoted in the context of the imported module. dynEnv.funcDefn(expanded-QName(Type1, ..., Typen)) = #IMPORTED(URI) URI =>module_statEnv statEnv1 URI =>module_dynEnv dynEnv1 statEnv1.funcType(expanded-QName) = { FunctionSig1', ..., FunctionSigm' } FunctionSigi' = declare function expanded-QName(Type1', ..., Typen') as Type' dynEnv1.funcDefn(expanded-QName(Type1', ..., Typen')) = (Expr, Variable1, ... , Variablen) statEnv1 |- Value1 against Type1 promotes to Value1' ... statEnv1 |- Valuen against Typen promotes to Valuen' dynEnvDefault + varValue( Variable1 => Value1; ...; Variablen => Valuen) |- Expr => Value --------------------------------------------------------------------------------------------------------- dynEnv |- function expanded-QName with types (Type1,...,Typen) on values (Value1,...,Valuen) yields Value
Received on Wednesday, 27 July 2005 13:05:18 UTC