Keith Waclena's Programming Language Crisis


Features and Misfeatures of Programming Languages

How well does K do when measured against KW's feature-list?

Critical Features

Memory-Mangement 		 200		200	reference counting
Aggregates 			 200 		200	vectors, lists, dictionaries (k4: tables, keyed tables)
First-Class-Data 		 200 		200	f x for any x
Modules 			 200 		100	K tree, scripts
Recursion 			 200 		100	fixed stack size, stack error if too deep
8bit 				 100 		200	text:0:, mmap binary:1:, copy binary:2:, bytes:6:
First-Class-Functions 		 100 		200	+ and {x+y} are first-class
Posix 				 100 		 50	only via c, java, 2:, or use 3: 4: (native ipc, system calls)
Objects 			 100 		  0	NA - variables have first-class attributes, triggers, dependencies
Separate-Compilation 		 200 		200	interpreted, scripts
--
				1600 	       1450

Important Features

Strong-Typing 			 60 		60	trapped execute, token/length/type/domain/&c. errors
Extensive-Library 		 50 		25	powerful primitive set, critical libraries from kx, else from community
Standard 			 40 		40	single implementation
Exceptions 			 60 		60	signal and trap (k4: execute alternate)
Syntax 			 	 30 		30	noun-verb-adverb + syntactic sugar, precedence-free
Local-Functions 		 20 		20	f:{g:{x+y};g[x;y]}
Static-Typing 			 20 		 0	dynamic typing	
Macros 			 	 40 		30	no macros, but flexible control structures (if, do, while :[]) + adverbs
Exec 				 20 		10	`3: `4:
FFI 				 10 		10	2:
Pattern-Matching 		 50 		40	_sm _ss _ssr pattern-matching, regexp via 2:
Numbers 			 10 		10	int float (k4: bool byte short int long real float 
 							char sym month date datetime minute second time enum)
--
				410	       335

Minor Features

Streams 			 5 		0
Currying 			 9 		9	f:{x-y};g:f[2];h:f[;3]
Coroutines 			 5 		0
Type-Inference 		 	 4 		0
Multiple-Value-Return 		 3 		3	{(x+y;x-y)}[2;3] -> 5 -1
Circles 			 3 		0
Continuations 			 3 		0
Reflexivity 			 3 		3	the K tree is a first-class dictionary
Persistance 			 3 		3	(k4: files are variables)
GUI 				 1 		1	native GUI (`show$ `hide$)
--
				39	       19

Have I been too generous in my point-assignments? I think not. For example, consider KW's grading of Python. Python has a fixed stack-size, so recursions have limited depth. But KW has awarded the full 200 points, whereas I give K only 100. Again, Python receives a perfect score for first-class functions, although even proponents of this language acknowledge that Python lambdas have limited functionality.

Features and Misfeatures of Programming Language Implementations

KW also considers properties of implementations:

Freely distributable?				yes: eval version is object-size- and message-number-limited
Interpreted implementation?			yes
Compiled implementation?			no
Dynamic loading for foreign functions?		yes
An interactive source-level debugger		yes and no: use the console

Benchmarks

Click here for a K implementation of KW's benchmark tasks. Test files are here.

Results* are:

BenchmarkProgramRun Time (secs)Space Used(K)Space Allocated(K)Compile Time (secs)Source Size (K bytes)
takK0.031100< 1
fgrepK0.0151010560< 1
invertK0.0316768211130< 1

*Pentium 4, cpu: 3 ghz, ram: 2 gb

NB: 7 = tak[18;12;6], words.txt has 24012 bytes, 220542 words, invert result has 1301 rows.