Download presentation
Presentation is loading. Please wait.
Published byMorris Barton Modified over 8 years ago
1
CR4904
2
CR is about: –templates (neither named not in-line) shall not be of default type, while e.g. template variables are allowed –allow templates to be of default type What can be of default type? –See next slide
3
can be of default typeref. clauseused in expressi ons send/receive constantsyes10yes module parametersno8.2.1yes value variablesyes(11.1)yes template variablesyes(11.2)noyes template definitionsno15.3noyes in-line templatesno15.4noyes template formal value parameterno5.4yes template formal template parameterno5.4noyes function/altstep formal value parameteryes5.4yes function/altstep formal template parameteryes5.4, 5.4.1.2!noyes external function formal parameteryes external functions -> the same as functions but operations with defaults are not allowed yes5.4yes testcase formal value parameterno5.4yes testcase formal template parameterno5.4noyes function return type (value)yes(16.1)yes function return type (template)yes(16.1)noyes What can be of default type?
4
Considerations –Today the standard is really NOT consistent regarding if template-kind definitions can be of default type or not –instances of default type are: strictly local, concrete values are always unique! for the user the value itself has no meaning at all; just the (name of the) variable in which the value is stored, may have any context meaning no matching mechanism is allowed for default types (see table 10) what matching mechanisms could be used with default s? –specific vale: default:null, v_default //the same as v_default itself –value list: (null,null,null) //the same as == null –complemented list: complement(null,null,null) //the same as != null –anyValue: ? //the same as != null –subset/superset: var template default vt_def; var SetOfDef v_Sdef; …//activate statements, default handles are stored in elements of set of default vt_def := superset( ); ------------------ template SetOfDef t_Sdef(default p1, default p2) := superset(p1,p2); … if(match(t_Sdef(v_Sdef[0],v_Sdef[1]),v_Sdef)); //the same as if(v_Sdef[0]==v_Sdef[0] and v_Sdef[1] ==v_Sdef[1]) ------------------
5
Considerations (contd.) –subset/superset (contd.) var template SetOfDef5 vt_Sdef5 := superset(null); var SetOfDef5 v_Sdef5 := {null,null,null,null,null}; …//activate statements, default handles are stored in elements of set of default if(match(vt_Sdef5,v_Sdef5)){/* what to do here, once we do not know, *which* default has not been activated? */ }; // the same as for (var integer i := 0; i<lengthof(v_Sdef5); i:=i+1) { if(v_Sdef5[i]==null) {v_Sdef5[i]:=activate(Myaltstep(i))} } //pls. note, even this checking-in-loop example can be used only if the same altstep //is activated several times with different parameters; one-by-one checking has to be //used otherwise thus no matching mechanism would makes sense in relation to default instances -> matching is working on the values themselves and has no relation to the storing place -> no known example that cannot be coded by using default values (e.g. record of default). Proposal –forbid all template-kind language elements to be of default type –Isn’t it backward incompatible?: on paper yes, but in practice there was no practical sense to use e.g. template default parameters or template variables up to know
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.