axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Axiom-developer] B#


From: Bill Page
Subject: RE: [Axiom-developer] B#
Date: Mon, 21 Nov 2005 11:53:42 -0500

On November 20, 2005 11:50 PM Gaby wrote:
> | 
> | We have mentioned before on this list the very good article
> | 
> | http://en.wikipedia.org/wiki/Datatype
> | 
> | about type systems in programming languages. "strong type
> | checking" has several different definitions but I think most
> | people would agree that Lisp is a strong dynamically typed
> | language by most of these definitions.
> 
> That is interesting but the link above is confused to start with.
> I quote: 
> 
>    An example of the absence of strong typing is a C cast 
>    gone wrong; if you cast a value in C, not only is the
>    compiler required to allow the code, but the runtime is
>    expected to allow it as well.
> 
> That is misleading at best. The core C system is consistent 
> -- the only trouble is that I would be in difficult position
> to prove it, in the mathematical sense because I have not sense
> any formal definition of C in the mathematical sense.  However,
> the fundamental point is that if you make a cast, the runtime is
> not required to accept it if it is semantically ill-formed. And
> the compiler is not required to accept it if it can somehow
> determine that it is invalid.  In fact, we're seeing more
> compilers taking advantages of those semantics invariants, in
> terms of optimizations.
>

I think you are wrong. For example consider this example:

/*
  'caste' example of weak typing in C
   Author: Bill Page
   Date: 21 Nov 2005
*/
#include <stdio.h>
int main(int argn, char *argv[]) {
float j;

  (int)j = 1;
  printf("float: %d\n",j);
  return 0;
}

------

You can compile this with gcc without errors and it runs without
error. What result would you expect it to return?
 
I still think the referenced article is well balanced and
accurate.

Regards,
Bill Page.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]