On Jun 13, 2009, at 7:04 PM, Todd O'Bryan wrote:
> or am I still not correctly verbalizing/understanding what I'm
> asking for?
You are but like a typical consumer and many computer scientists, you
are proposing a solution instead of stating and describing the problem.
;; ---
1. We made the decision to go without static types for good reason.
You don't want types (at the beginning).
2. What we call contracts in BSL and what we call contracts in PLT
Scheme is only loosely related. So you don't want contracts either.
3. In the German version of HtDP, dubbed DeinProgram, you state HtDP-
style contracts in a formal language and they are checked as your BSL/
ISL programs are run. It would cut down your students' 'debugging'
time a lot. See DeinProgram in DrScheme, but you may need to know a
bit of German.
4. We intend to support something like this sooner or later. Robby
has been working on this since 2004.
5. I don't understand how your students can have test cases for each
function and NOT see that their functions are producing the wrong
things. Code excerpts would be helpful.
All in all you aren't asking for a perfect language. You're asking
for very doable things. (Python's nonsense confused the heck out of
you. Give up on it. Study ML and then jump to Cayenne. Students will
never mistakes again, because they won't get any programs past the
type checkers :-)
-- Matthias
;; ----
P.S. For your reading pleasure, a first draft of the proposed
teachpack for providing type-of and friends:
#lang scheme
(require lang/prim)
(provide type-of)
;; Any -> Type
(define (type-of a)
(cond
[(number? a) Number]
[(string? a) String]
[(boolean? a) Boolean]
[(procedure? a) Procedure]
[(type? a) Type]))
(define-syntax-rule (def-types type? Name ...)
(begin (provide type? Name ...)
(define (type? x)
(member x (list Name ...)))
(define Name (gensym 'Name))
...))
(def-types type? Type Number String Boolean Procedure)
I took the liberty of writing a macro to define the types. You can
define them one by one, w/i the BSL language!!!
Here is an interaction:
Welcome to DrScheme, version 4.2.0.3-svn12jun2009 [3m].
Language: Intermediate Student.
This program should be tested.
> (type-of 3)
'Number3989
> (type-of cons)
'Procedure3992
> (type-of true)
'Boolean3991
> (type-of (type-of true))
'Type3988
>