One type of software is referred to as a “runtime”. A runtime provides underlying functionality that can be used by multiple applications that run on a computing system. One distinct type of runtime is called a “continuation based runtime”. A continuation based runtime executes activities. An activity represents a unit of executable code that consists of multiple pulses of work. For instance, suppose an activity is to receive messages. In that case, one pulse of work might be to set up the computing system with proper configuration and state to receive messages, and then pause until a message is received. Another pulse of work might occur when a message is received, which might involve setting up the message so that data can be extracted from the message. Another pulse of work might be to extract the data from the message itself, and so forth.
One of the ways an activity can execute multiple pulses of work is through the scheduling of child activities. This composition of activities enables custom control flows that can be implemented through the scheduling of child activities 0, 1 or n times as determined by the composite activity. Beyond this flexibility to create new control flows, activities in a continuation based runtime have a number of distinct characteristics. For instance, such activities have no process affinity in that they can be paused in one process, and resumed in a different process, and may also run on different threads. Such activities can also be persisted into persistent storage for later rehydration back into memory.
An expression is a combination of literals, symbols, operators, and possibly other expressions which evaluates to a value or a location in the context of an environment. In a continuation based runtime, expressions are used as properties on activities (e.g. the conditions on a while loop) as well as for binding activity parameters to an environment.
Embodiments described herein allow a continuation based runtime to resolve different types of location expressions, value expressions, and/or locations. In one embodiment, this is accomplished using a different class for each particular type. The location expression classes may each have a common method used for all of the location expression classes. The value expression classes may each have a common method, and the locations may also each have a common method. This allows the resolution of such location and value expressions to be treated in a unified fashion regardless of the type of location expression, or the type of value expression. Also, the location may be treated in a unified manner regardless of the type of location.
This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.
In order to describe the manner in which the above-recited and other advantages and features can be obtained, a more particular description of various embodiments will be rendered by reference to the appended drawings. Understanding that these drawings depict only sample embodiments and are not therefore to be considered to be limiting of the scope of the invention, the embodiments will be described and explained with additional specificity and detail through the use of the accompanying drawings in which:
In accordance with embodiments described herein, a continuation based runtime is permitted to resolve different types of location expressions, value expressions, and/or locations. In one embodiment, this is accomplished using a different class for each particular type. The location expression classes may each have a common method used for all of the location expression classes. The value expression classes may each have a common method, and the locations may also each have a common method. This allows the resolution of such location and value expressions to be treated in a unified fashion regardless of the type of location expression, or the type of value expression. Also, the location may be treated in a unified manner regardless of the type of location. First, some introductory discussion regarding message processors will be described with respect to
A message processor may be implemented in software or hardware, or a combination thereof
As illustrated in
In the description that follows, embodiments are described with reference to acts that are performed by one or more computing systems. If such acts are implemented in software, one or more processors of the associated computing system that performs the act direct the operation of the computing system in response to having executed computer-executable instructions. An example of such an operation involves the manipulation of data. The computer-executable instructions (and the manipulated data) may be stored in the memory 104 of the computing system 100.
Computing system 100 may also contain communication channels 108 that allow the computing system 100 to communicate with other message processors over, for example, network 110. Communication channels 108 are examples of communications media. Communications media typically embody computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism and include any information-delivery media. By way of example, and not limitation, communications media include wired media, such as wired networks and direct-wired connections, and wireless media such as acoustic, radio, infrared, and other wireless media. The term computer-readable media as used herein includes both storage media and communications media.
Embodiments within the scope of the present invention also include computer-readable media for carrying or having computer-executable instructions or data structures stored thereon. Such computer-readable media can be any available media that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise physical storage and/or memory media such as RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to carry or store desired program code means in the form of computer-executable instructions or data structures and which can be accessed by a general purpose or special purpose computer. When information is transferred or provided over a network or another communications connection (either hardwired, wireless, or a combination of hardwired or wireless) to a computer, the computer properly views the connection as a computer-readable medium. Thus, any such connection is properly termed a computer-readable medium. Combinations of the above should also be included within the scope of computer-readable media.
Computer-executable instructions comprise, for example, instructions and data which cause a general purpose computer, special purpose computer, or special purpose processing device to perform a certain function or group of functions. Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described herein. Rather, the specific features and acts described herein are disclosed as example forms of implementing the claims.
A runtime is software functionality that provides services to applications that run on a computing system. For instance,
In one embodiment, the runtime 330 may be a continuation based runtime. A continuation based runtime performs pulses of work in the form of activities. Such activities are provided from one of the applications 310. For instance, application 311 is illustrated as providing activity 341 to the activity manager 331 of the runtime. Each activity may be hierarchically structured such that parent activities may include 0, 1 or more child activities of a given type.
The activity manager 311 generates activity instances 350 from the information defined in activity 341 provided by the application 311. For example, in
Some of the activities include expressions. For instance, referring to
In
Each value expression class will use the environment of the expression (along with potentially other contextual information that represents the program state relative to the expression) to resolve an expression into an actual value. In contrast, each location expression class will use at least portions of the environment of the expression with potentially other contextual information to resolve an expression into a location, which points to a storage from which a value may be extracted. A corresponding location class may be used to resolve that returned location into an actual literal value.
LocationExpression class 411 is an abstract class that inherits properties from the ValueExpression class 411. However, LocationExpression class 411 contains a method “GetLocation” in addition to the method “GetValue”. GetValue and GetLocation can be implemented synchronously or asynchronously as activities that get executed by the continuation based runtime as part of expression evaluation. Notably, basing expressions on activities yields several of the benefits of the continuation based runtime in the context of expressions. The LocationExpression class 411 serves as the root abstract class for all location expression classes in the inheritance tree. The various location expression classes of the inheritance tree 400 will first be described, followed by the various value expression classes.
The various child location expression classes 421, 422 and 423 each inherit the GetLocation method from the LocationExpression class 411, and also inherit all properties in its ancestral chain in the inheritance tree 400. A VariableLocationExpression is initialized with a variable. The GetLocation method of the VariableLocationExpression class 421 receives as an input parameter an environment, and contains all logic necessary to resolve that variable into a location. A LambdaLocationExpression is initialized with a LambdaExpression. The GetLocation method of the LamdaLocationExpression class 422 receives as an input an environment and evaluates the LambdaExpression into a location. An actual example of such expressions will be described further below. Note that all of the location expression classes have a common method “GetLocation” (which can be implemented synchronously or asynchronously in a continuation-based fashion). This allows for a relatively unified interface when requesting that the location expression class resolve a location expression, regardless of the type of location expression being resolved.
LocationExpression represents the concept of lvalues in the continuation based runtime. These are expressions that yield a location in the context of an environment. They are legal both as the source or target of an assignment activity. When used as an rvalue, location expressions yield a value. As lvalues, a location expression yields a location.
The various child value expression classes 412 and 413 each inherit the GetValue method from the ValueExpression class 401, and also inherit all properties in its ancestral chain in the inheritance tree 400. A LiteralExpression is initialized with a literal value. The GetValue method of the LiteralValueExpression class 421 receives as an input parameter an environment, and returns the pre-configured literal as its value. The StringFormatExpression is initialized with a format string and additional sub-expressions that represent the values to use in the format string. The GetValue method of the StringFormatExpression class 422 receives as an input parameter an environment and resolves that into a value. Actual examples of such expressions will also be described further below. Note that all of the value expression classes have a common method “GetValue” (which can be implemented synchronously or asynchronously in a continuation-based fashion). This allows for a relatively unified interface when requesting that the value expression class resolve a value expression, regardless of the type of value expression being resolved. LiteralExpression represents a literal rvalue in a continuation based runtime. StringFormatExpression is a custom expression representing a tokenized format string that can be evaluated against an environment to yield a formatted string.
Referring to
A particular example of an activity will now be set forth as follows with line numbering added for clarity and for purposes of subsequent reference:
In this particular activity example, the activity is expressed declaratively using XAML formatting. Lines 1-17 represent the entire parent activity, which is called “Prompt” and contains a number of child activities. Lines 2-5 include the parameters of the activity. In particular, line 3 defines an activity input parameter called “Message” of type string. Line 4 defines an activity output parameter called “Result” also of type string.
Lines 6-16 define the actual body of the activity including local variable declarations, as well as a sequence of child activities to be performed. In lines 8-10, the local variables for the sequence are defined. In particular, line 9 defines a local variable called “Response”, which is declared to be of type string. Together, the parameters and variables of an activity become the dereferenceable locations in the environment of the activity.
Lines 11-16 define a sequence of child activities to be performed. In particular, the first child activity in line 12 is a “WriteLine” activity, which receives as an input parameter “Text”. “Text” is a WriteLine activity argument that is set equal to an expression called “[Message]”. In the syntax presented in the example, expressions are bounded by square brackets “[” and “]”. In this example, such expressions are used to bind parameter arguments (such as “Text”) to the environment (e.g., to the parent activity parameters “Message” and “Result”, and local variables “Response”). Accordingly, the expression should be resolved in order to perform the Writeline activity. Otherwise, the value of the input parameter “Text” for the WriteLine activity will not be known.
In the environment of
Returning to the XAML example, the [Message] expression will resolve to a value, which is whatever value was passed in with the input parameter “Message” of type string in the parent “Prompt” activity. Suppose, for example, that the string value of Message is “Please enter your age>”. The activity manager 331 may know that this value is an input parameter to the “Prompt” argument, and that it is declared to be of type “string”, which is a literal type. Accordingly, the expression resolution module 343 will use the LiteralExpression class 412 of
The activity manager 331 also identifies from the expression one or more input parameters to provide to the object instance of the class (act 60). In this case, the input parameter is the string “Message” or some other identifier that the expression represents the input parameter to the “Prompt” activity, execution stood at line 11, when the activity manager passed the expression [Message] to the activity manager 331 for resolution. Upon receiving the string value “Please enter your age>” as a return, the activity manager 331 may bind that string value to the WriteLine activity's input parameter “Text”. Thus, Text is equal to “Please enter your age>”. The Writeline activity is thus called with this input, and the line “Please enter your age>” is written to the default output device (e.g., the display).
Referring to
The object instance of the expression class receives the request (act 611), resolves the expression class (act 612), and returns the resolved value (act 613). Recall that this resolution may occur synchronously or asynchronously in a continuation based runtime. In some cases, it may be some time before the request is resolved, and the object instance of the expression class may even be persisted prior to resolution. In the case of the LiteralExpression class, the expression resolution module will extract the value of the input parameter “Message” passed into the “Prompt” activity. The appropriate expression value (e.g., the string “Please enter your age>”) will then be returned back to the activity manager 331, whereupon it is received by the activity manager (act 605) for further execution of the activity.
The activity manager 331 then proceeds to the next child activity in the sequence in line 12. Here, we have a “ReadLine” activity, which also has an output parameter called “Result” which is set equal to a location expression “[Response]”. Here, this is a location expression, which resolves to a location where a value is, rather than a value itself. In particular, the location that it resolves to is simply the variable “Response”. In other words, the output parameter “Result” of the ReadLine activity is set equal to whatever value is stored at the location identified by the variable “Response”.
The activity manager 331, upon encountering another expression, identifies the environment for the expression “[Response]”. In this case, the expression resolution module may be an object instance of the VariableLocationExpression class 421, which resolves the expression (in the context of its environment) into a location “Response” which is then returned to the activity manager 331. For instance, the expression resolution object 343 passes the location 344 back to the activity manager 331. The activity manager 331 then performs the activity “ReadLine” using the Text location “Response”, which basically causes a line of text to be read into the Response location. The line of text might come from a keyboard buffer, or other input device. Suppose for subsequent discussion that the user entered the string “35 Years Old” into the keyboard in response to the string “Please enter your age>” being written to the display.
Upon completion of the ReadLine activity in line 12 of the “Prompt” activity. The activity manager 331 then executes the WriteLine activity of line 13. Here, the input parameter Text is set equal to the expression [‘The user entered:’+Response]”, which is a string format expression in compound form. The StringFormatExpression class may thus be used to resolve the expression into the literal value “The user entered: 35 Years Old”. The activity manager then writes this value to the display using the WriteLine activity of line 13 of the “Prompt” activity.
In line 14, the Assign activity assigns the resolved value of the expression [Response], which has been resolved to “35 Years Old”, to the resolved location value of the expression “└Result┘”, which is the location of the output parameter for the entire “Prompt” activity. When the “Prompt” activity returns, it will return the value “35 Years Old” as its output parameter.
Accordingly, a flexible and unified expression resolution mechanism has been described in which location expressions of a variety of different types may be resolved using a common method, and in which value expressions of a variety of different types may be resolved using a common method.
Returning back to
Accordingly, the embodiments described herein present an effective mechanism for resolving expressions and locations in a unified manner. The present invention may be embodied in other specific forms without departing from its spirit or essential characteristics. The described embodiments are to be considered in all respects only as illustrative and not restrictive. The scope of the invention is, therefore, indicated by the appended claims rather than by the foregoing description. All changes which come within the meaning and range of equivalency of the claims are to be embraced within their scope.
Number | Name | Date | Kind |
---|---|---|---|
5742806 | Reiner et al. | Apr 1998 | A |
5822585 | Noble et al. | Oct 1998 | A |
5956512 | Simmons et al. | Sep 1999 | A |
5970498 | Duffield et al. | Oct 1999 | A |
6014666 | Helland et al. | Jan 2000 | A |
6067413 | Gustafsson et al. | May 2000 | A |
6163774 | Lore et al. | Dec 2000 | A |
6182277 | DeGroot et al. | Jan 2001 | B1 |
6542891 | Loen et al. | Apr 2003 | B1 |
6553268 | Schwenke et al. | Apr 2003 | B1 |
6678696 | Helland | Jan 2004 | B1 |
6718535 | Underwood | Apr 2004 | B1 |
6738968 | Bosworth et al. | May 2004 | B1 |
6757887 | Kaplan | Jun 2004 | B1 |
6901578 | Beaven | May 2005 | B1 |
7043722 | Bau, III | May 2006 | B2 |
7150010 | Ringseth et al. | Dec 2006 | B1 |
7203866 | Di Fabbrizio et al. | Apr 2007 | B2 |
7225425 | Kompalli et al. | May 2007 | B2 |
7254809 | Kurhekar et al. | Aug 2007 | B2 |
7356767 | Dahyabhai et al. | Apr 2008 | B2 |
7398525 | Leymann | Jul 2008 | B2 |
7451392 | Chalecki | Nov 2008 | B1 |
7496887 | Grasselt | Feb 2009 | B2 |
7606824 | Sanabria | Oct 2009 | B2 |
7607123 | Chavan | Oct 2009 | B2 |
7734958 | Di Fabbrizio et al. | Jun 2010 | B1 |
7761586 | Olenick et al. | Jul 2010 | B2 |
7774699 | Lin | Aug 2010 | B2 |
7813741 | Hendrey et al. | Oct 2010 | B2 |
7827127 | Wolf et al. | Nov 2010 | B2 |
7836428 | Mitchell | Nov 2010 | B2 |
7966605 | Di Fabbrizio et al. | Jun 2011 | B1 |
8019770 | Hartsook et al. | Sep 2011 | B1 |
20030105654 | MacLeod | Jun 2003 | A1 |
20040044987 | Kompalli | Mar 2004 | A1 |
20050050069 | Vaschillo | Mar 2005 | A1 |
20050097514 | Nuss | May 2005 | A1 |
20050114771 | Piehler et al. | May 2005 | A1 |
20060041872 | Poznanovic et al. | Feb 2006 | A1 |
20060064574 | Rolfs | Mar 2006 | A1 |
20060074704 | Shukla et al. | Apr 2006 | A1 |
20060074730 | Shukla et al. | Apr 2006 | A1 |
20060074732 | Shukla et al. | Apr 2006 | A1 |
20060074737 | Shukla et al. | Apr 2006 | A1 |
20060242173 | Tsyganskiy | Oct 2006 | A1 |
20060248519 | Jaeger et al. | Nov 2006 | A1 |
20070033659 | Hoche et al. | Feb 2007 | A1 |
20070044144 | Knouse et al. | Feb 2007 | A1 |
20070061799 | Kimmerly | Mar 2007 | A1 |
20070083813 | Lui et al. | Apr 2007 | A1 |
20070168327 | Lindblad et al. | Jul 2007 | A1 |
20070233969 | Shukla et al. | Oct 2007 | A1 |
20070239498 | Shukula et al. | Oct 2007 | A1 |
20070239499 | Shukla et al. | Oct 2007 | A1 |
20070239505 | Shukla et al. | Oct 2007 | A1 |
20070288223 | Werkmann | Dec 2007 | A1 |
20070300185 | Macbeth | Dec 2007 | A1 |
20080120594 | Lucas | May 2008 | A1 |
20080140645 | Denoual | Jun 2008 | A1 |
20080216094 | Anderson et al. | Sep 2008 | A1 |
20080320031 | Denoual | Dec 2008 | A1 |
20090112779 | Wolf et al. | Apr 2009 | A1 |
20090150854 | Elaasar | Jun 2009 | A1 |
20090222827 | Pinto | Sep 2009 | A1 |
20090259514 | Kumar et al. | Oct 2009 | A1 |
20100169862 | Wolf et al. | Jul 2010 | A1 |
Number | Date | Country | |
---|---|---|---|
20090222794 A1 | Sep 2009 | US |