CR4904. 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.

Slides:



Advertisements
Similar presentations
CS3012: Formal Languages and Compilers Static Analysis the last of the analysis phases of compilation type checking - is an operator applied to an incompatible.
Advertisements

Generics, Lists, Interfaces
Arrays.
Composition CMSC 202. Code Reuse Effective software development relies on reusing existing code. Code reuse must be more than just copying code and changing.
Lecture 16 Subroutine Calls and Parameter Passing Semantics Dragon: Sec. 7.5 Fischer: Sec Procedure declaration procedure p( a, b : integer, f :
Chapter 10 Introduction to Arrays
ECE 103 Engineering Programming Chapter 11 One Minute Synopsis Herbert G. Mayer, PSU CS Status 7/1/2014.
Abstract Data Types Data abstraction, or abstract data types, is a programming methodology where one defines not only the data structure to be used, but.
1 Module 2: Fundamental Concepts Problems Programs –Programming languages.
Compunet Corporation1 Programming with Visual Basic.NET Creating and Using Classes Lecture # 8 Tariq Ibn Aziz.
Chapter 9: Subprogram Control
1 Module 10 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive.
Object Oriented Software Development
Using Data Active Server Pages Objectives In this chapter, you will: Learn about variables and constants Explore application and session variables Learn.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
Page 1 Topic 4 Relational Databases CPS510 Database Systems Abdolreza Abhari School of Computer Science Ryerson University.
Lecture 7 Integrity & Veracity UFCE8K-15-M: Data Management.
CIS 234: Control Structures - Selection Dr. Ralph D. Westfall April, 2010.
C++ Function 1. Function allow to structure programs in segment of code to perform individual tasks. In C++, a function is a group of statements that.
Lecture Set 11 Creating and Using Classes Part B – Class Features – Constructors, Methods, Fields, Properties, Shared Data.
Copyright © 2002, Systems and Computer Engineering, Carleton University a-JavaReview.ppt * Object-Oriented Software Development Unit.
1 © 2002, Cisco Systems, Inc. All rights reserved. Arrays Chapter 7.
110-G1 Motivation: Within a program, may have to perform the same computation over and over Many programs share the same computation (e.g. sorting) To.
Stored Procedures Week 9. Test Details Stored Procedures SQL can call code written in iSeries High Level Languages –Called stored procedures SQL has.
ADTs and C++ Classes Classes and Members Constructors The header file and the implementation file Classes and Parameters Operator Overloading.
ECE122 Feb. 22, Any question on Vehicle sample code?
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Python Functions.
Implementing Subprograms What actions must take place when subprograms are called and when they terminate? –calling a subprogram has several associated.
C Functions Three major differences between C and Java functions: –Functions are stand-alone entities, not part of objects they can be defined in a file.
CS536 Semantic Analysis Introduction with Emphasis on Name Analysis 1.
March 2006 Copyright, 2006 Oxford Consulting, Ltd C++ Templates Templates F Part of the ongoing development of the C++ language F Integral part.
CS212: Object Oriented Analysis and Design
Introduction to C Programming Lecture 6. Functions – Call by value – Call by reference Arrays Today's Lecture Includes.
CIS 270—Application Development II Chapter 8—Classes and Objects: A Deeper Look.
Types of C Variables:  The following are some types of C variables on the basis of constants values it has. For example: ○ An integer variable can hold.
Object-Oriented Programming © 2013 Goodrich, Tamassia, Goldwasser1Object-Oriented Programming.
Structured Programming (4 Credits) HNDIT Week 2 – Learning Outcomes Design an algorithmic solution for simple problem such as computation of a factorial,
Methods Methods are how we implement actions – actions that objects can do, or actions that can be done to objects. In Alice, we have methods such as move,
Introduction to Object-Oriented Programming Lesson 2.
CSI 3125, Preliminaries, page 1 Class. CSI 3125, Preliminaries, page 2 Class The most important thing to understand about a class is that it defines a.
 Introduction  Structure of Management Information  Practical Issues  Summary 2.
Inheritance and Polymorphism. Superclass and Subclass Inheritance defines a relationship between objects that share characteristics. It is a mechanism.
Classes, Interfaces and Packages
PHP Reusing Code and Writing Functions 1. Function = a self-contained module of code that: Declares a calling interface – prototype! Performs some task.
ENEE150 – 0102 ANDREW GOFFIN More With Pointers. Importance of Pointers Dynamic Memory (relevant with malloc) Passing By Reference Pointer Arithmetic.
Singleton Pattern. Problem Want to ensure a single instance of a class, shared by all uses throughout a program Context Need to address initialization.
1 Chapter 9 Undecidability  Turing Machines Coded as Binary Strings  Universal Turing machine  Diagonalizing over Turing Machines  Problems as Languages.
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
1 Chapter 7 Pointers and C-Strings. 2 Objectives  To describe what a pointer is (§7.1).  To learn how to declare a pointer and assign a value to it.
Internet Computing Module II. Syllabus Creating & Using classes in Java – Methods and Classes – Inheritance – Super Class – Method Overriding – Packages.
CSC 243 – Java Programming, Spring, 2014 Week 4, Interfaces, Derived Classes, and Abstract Classes.
CPSC 252 ADTs and C++ Classes Page 1 Abstract data types (ADTs) An abstract data type is a user-defined data type that has: private data hidden inside.
Mr H Kandjimi 2016/01/03Mr Kandjimi1 Week 3 –Modularity in C++
LESSON 8: INTRODUCTION TO ARRAYS. Lesson 8: Introduction To Arrays Objectives: Write programs that handle collections of similar items. Declare array.
Anytype – what does it mean? Currently, anytype is a union of all known types in the context of the reference to the type anytype (excluding imported name-clashing.
TK1924 Program Design & Problem Solving Session 2011/2012
Exception Handling C++.
User-Written Functions
Extension Package: Behaviour Types
Function There are two types of Function User Defined Function
CS212: Object Oriented Analysis and Design
Using local variable without initialization is an error.
METHODS AND BEHAVIORS AKEEL AHMED.
Lecture 15 (Notes by P. N. Hilfinger and R. Bodik)
Subprograms and Programmer Defined Data Type
Java Programming Language
Functions Imran Rashid CTO at ManiWeber Technologies.
Creating and Using Classes
Scope Rules.
Presentation transcript:

CR4904

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

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, !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?

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])

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