type-of funciton pullout

0 views
Skip to first unread message

Anonymer

unread,
Nov 23, 2010, 6:11:05 PM11/23/10
to byu-cs-330-Fall-2010
What is the responsibility of the app condition on the type case in
the type-of function? It has to check the type of the incoming
argument to make sure it matches what the function says its argument's
type should be, correct? And the fun branch checks to make sure it's
body results in the correct type, correct? Does the app branch need
to get at the innards of the function expression to see what it's
argument type should be?

Is this a backward way of thinking about it?

Jay McCarthy

unread,
Nov 23, 2010, 6:13:39 PM11/23/10
to byu-cs-330...@googlegroups.com
On Tue, Nov 23, 2010 at 4:11 PM, Anonymer <theer...@gmail.com> wrote:
> What is the responsibility of the app condition on the type case in
> the type-of function?  It has to check the type of the incoming
> argument to make sure it matches what the function says its argument's
> type should be, correct?

Yes

>  And the fun branch checks to make sure it's
> body results in the correct type, correct?

fun branch?

> Does the app branch need
> to get at the innards of the function expression to see what it's
> argument type should be?

Not the function EXPRESSION, but the function TYPE

Jay

>
> Is this a backward way of thinking about it?

--
Jay McCarthy <j...@cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93

Anonymer

unread,
Nov 23, 2010, 6:18:45 PM11/23/10
to byu-cs-330-Fall-2010


On Nov 23, 4:13 pm, Jay McCarthy <jay.mccar...@gmail.com> wrote:
> > Does the app branch need
> > to get at the innards of the function expression to see what it's
> > argument type should be?
>
> Not the function EXPRESSION, but the function TYPE

Right. Ok, so how do you get at the function type that's in app's
first argument?

Jay McCarthy

unread,
Nov 23, 2010, 7:48:20 PM11/23/10
to byu-cs-330...@googlegroups.com, byu-cs-330-Fall-2010
If only there were a function that gave you the type of some expression...

:)

Sent from my iPhone

Anonymer

unread,
Nov 24, 2010, 2:06:00 PM11/24/10
to byu-cs-330-Fall-2010
ahahahah

On Nov 23, 5:48 pm, Jay McCarthy <jay.mccar...@gmail.com> wrote:
> If only there were a function that gave you the type of some expression...
>
> :)
>
> Sent from my iPhone
>
Reply all
Reply to author
Forward
0 new messages