February 22, 2012
On Wed, Feb 22, 2012 at 07:57:31PM +0100, Kagamin wrote:
> On Friday, 17 February 2012 at 06:25:49 UTC, H. S. Teoh wrote:
> >But who am I to speak out against more than four decades of historical accidents, right? I think I'll shut up now.
> 
> Can you forgive me a little investigation? I heard similar proposals and wonder where they come from. What do you think? It can't be python or golang, because they were already designed with there thoughts in mind.

Wait, which proposal? To replace && and || with 'and' and 'or'?

Or my slightly extreme rant about replacing '==' with '=' and '=' with ':=', amongst other things?


T

-- 
In a world without fences, who needs Windows and Gates? -- Christian Surchi
February 22, 2012
On Wednesday, 22 February 2012 at 19:04:55 UTC, H. S. Teoh wrote:
> Wait, which proposal? To replace && and || with 'and' and 'or'?
>
> Or my slightly extreme rant about replacing '==' with '=' and '=' with
> ':=', amongst other things?

Well, it's hard to explain. Proposals like python's semantic whitespace or golang's "array of ints should be typed as []int in order to match the pronunciation sequence: array-of-ints" or equality should be '='. I don't know why, but they have something in common.
February 22, 2012
On Wed, Feb 22, 2012 at 08:35:21PM +0100, Kagamin wrote:
> On Wednesday, 22 February 2012 at 19:04:55 UTC, H. S. Teoh wrote:
> >Wait, which proposal? To replace && and || with 'and' and 'or'?
> >
> >Or my slightly extreme rant about replacing '==' with '=' and '=' with ':=', amongst other things?
> 
> Well, it's hard to explain. Proposals like python's semantic whitespace

These come from Python users. :P

And maybe the fact that some people, for reasons unknown to me, just can't stand the sight of delimiting blocks with '{' and '}'. It's almost as if they get the creepy-crawlies when they see '{' and '}'. They'd much rather deal with words like 'begin' and 'end', or Python's semantic whitespace.


> or golang's "array of ints should be typed as []int in order to match the pronunciation sequence: array-of-ints"

That's just a native language bias. Well, it's not even that. If you interpret 'int' as an adjective, then int[] totally makes sense. But if you interpret 'int' as a genitive noun, then it'd be []int.

To me, I find []int ineffably ugly. Even array(int) is better than []int. But that's just me. Whether you write

	int x[];

or

	int[] x;

or

	[]int x;

or even

	x int[];

or any other permutation thereof, ultimately it's just a matter of conveying three pieces of information to the compiler: the name of the variable, the base type, and the fact that it's an array of the base type. If you could write code in 3D, you could equally well put these three elements in a triangle parallel to the flow of code, in which case order wouldn't even be an issue.

So it all boils down to personal preference.


> or equality should be '='.

That's coming from math geeks like me. :P


> I don't know why, but they have something in common.

I'm not sure I know what you're referring to. What else do they have in common, besides wanting to tweak language syntax to suit one's own preferences?

Preferences are shaped by what one is familiar with.  I'm sure if you manage to herd enough APL programmers in here, they'd be clamoring for D to start using APL symbols instead of this verbose procedural trash like for-loops. :-)

Or if you herd enough Lisp programmers in here... oh wait, we already
have std.functional. :-P  The only thing missing is to replace all ;
with , (except after the last statement in a block), standardize on ()
for {}, [] and (), then rename some keywords, and it'd be Lisp heaven on
earth!


T

-- 
It only takes one twig to burn down a forest. It only takes one twit to burn down a project.
February 22, 2012
> It does not serve any purpose to insist on closely similar notations.

So let's make '+' be '$' and '-' be '+'? My point wasn't that mathematical equations are identical to sequential code statements, but that they should, as much as possible, attempt to stay inline. It's all about how difficult programming is to pick-up.
February 22, 2012
On Wed, Feb 22, 2012 at 11:15:35PM +0100, F i L wrote:
> >It does not serve any purpose to insist on closely similar notations.
> 
> So let's make '+' be '$' and '-' be '+'?

Sounds like an esolang (http://esolangs.org/wiki/Main_Page) :)

Maybe I should invent one. I'll call it EsoD, for Esoteric D (or Evil Strain Of D). Syntax is exactly the same as D, except that instead of (), [], and {}, we write ~!, @#, and $%, respectively, and all keywords are spelt backwards. Addition is denoted ^, multiplication &, subtraction *, and division (. Assignment is denoted ), equality is -, and field access {. Lists are delimited by +, and statements end with =. Since } isn't used for anything, we'll use that instead of @ for properties.

So for example, here's a function that computes the average of an array:

	}efas erup tsnoc a f~a+z!~ni z@# b! $
		a c)0=
		hcaerof~d=b! $c^)d=%
		nruter c(b{htgnel=
	%

Here's an example of how to use it:

	tropmi dts{oidts=
	diov naim~! $
		nletirw~f|~laer!~@1+2+3+4+5#!!=
	%

If this looks hard, don't worry, once you are past the initial learning curve, it will all become crystal clear to you. ;-)


T

-- 
Indifference will certainly be the downfall of mankind, but who cares? -- Miquel van Smoorenburg
February 23, 2012
H. S. Teoh wrote:
> So for example, here's a function that computes the average of an array:
>
> 	}efas erup tsnoc a f~a+z!~ni z@# b! $
> 		a c)0=
> 		hcaerof~d=b! $c^)d=%
> 		nruter c(b{htgnel=
> 	%
>
> Here's an example of how to use it:
>
> 	tropmi dts{oidts=
> 	diov naim~! $
> 		nletirw~f|~laer!~@1+2+3+4+5#!!=
> 	%
>
> If this looks hard, don't worry, once you are past the initial learning
> curve, it will all become crystal clear to you. ;-)

Could be promising for dyslexics ;)
February 23, 2012
On 23 February 2012 19:28, F i L <witte2008@gmail.com> wrote:
> H. S. Teoh wrote:
>>
>> So for example, here's a function that computes the average of an array:
>>
>>        }efas erup tsnoc a f~a+z!~ni z@# b! $
>>                a c)0=
>>                hcaerof~d=b! $c^)d=%
>>                nruter c(b{htgnel=
>>        %
>>
>> Here's an example of how to use it:
>>
>>        tropmi dts{oidts=
>>        diov naim~! $
>>                nletirw~f|~laer!~@1+2+3+4+5#!!=
>>        %
>>
>> If this looks hard, don't worry, once you are past the initial learning curve, it will all become crystal clear to you. ;-)
>
>
> Could be promising for dyslexics ;)

The problem I had with it was having to stop myself from reading the entire lines from right-to-left.
1 2 3 4 5 6 7
Next ›   Last »