[erlang-questions] some language changes

ok ok@REDACTED
Thu May 24 05:35:16 CEST 2007


On 24 May 2007, at 6:04 am, Anthony Shipman wrote:
> How about allowing a semicolon after the last clause in a case or if
> expression or similar:
> 	case E of
> 	A -> ...;
> 	B -> ...;
> 	end

Starting from Prolog, where for years people have complained that
commas and semicolons are hard to visually discriminate on screen
(and on some printers), I've adopted the practice of putting
commas at the ends of lines but semicolons at the beginning.
I would really really like to write

	case E of
	; A -> ...
	; B -> ...
	end

This is rather like
	Ada			Fortran
	case E is		select case (E)
            when A =>		   case (A)
               ...                     ...
	   when B =>		   case (B)
               ...                     ...
	end case 		end select

with the semicolon playing the role of when/case.
It's a simple matter of changing
	case_expr -> 'case' expr 'of' cr_clauses 'end' : ...
to
	case_expr -> 'case' expr of cr_clauses 'end' : ...

	of -> 'of' ';'.
	of -> 'of'.

with the same change

	try_expr -> 'try' exprs 'of' cr_clauses try_catch : ...
becoming
	try_expr -> 'try' exprs of cr_clauses try_catch : ...

(As far as I can tell those are the only two uses of 'of'.)





More information about the erlang-questions mailing list