"Strong typing vs. strong testing"

Nick 3-nospam at temporary-address.org.uk
Tue Sep 28 21:12:51 CEST 2010

tar at sevak.isi.edu (Thomas A. Russ) writes:

> Malcolm McLean <malcolm.mclean5 at btinternet.com> writes:
>> I'd like to design a language like this. If you add a quantity in
>> inches to a quantity in centimetres you get a quantity in (say)
>> metres. If you multiply them together you get an area, if you divide
>> them you get a dimeionless scalar. If you divide a quantity in metres
>> by a quantity in seconds you get a velocity, if you try to subtract
>> them you get an error.
> Done in 1992.
> See 
>  <http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/syntax/measures/0.html>
>  citation at <http://portal.acm.org/citation.cfm?id=150168>
> and my extension to it as part of the Loom system:
>    <http://www.isi.edu/isd/LOOM/documentation/loom4.0-release-notes.html#Units>

I didn't go as far as that, but:

$ cat test.can
database input 'canal.sqlite'

for i=link 'Braunston Turn' to '.*'
	print 'It is ';i.distance into 'distance:%M';' miles (which is '+i.distance into 'distance:%K'+' km) to ';i.place2 into 'name:place'
end for i
$ canal test.can
It is 0.10 miles (which is 0.16 km) to London Road Bridge No 90
It is 0.08 miles (which is 0.13 km) to Bridge No 95
It is 0.19 miles (which is 0.30 km) to Braunston A45 Road Bridge No 91
Online waterways route planner            | http://canalplan.eu
Plan trips, see photos, check facilities  | http://canalplan.org.uk

More information about the Python-list mailing list