[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave's and Matlab's limitations

From: Sergei Steshenko
Subject: Re: Octave's and Matlab's limitations
Date: Wed, 21 Nov 2012 16:02:03 -0800 (PST)

----- Original Message -----
> From: Dimitri Maziuk <address@hidden>
> To: address@hidden
> Cc: 
> Sent: Thursday, November 22, 2012 1:18 AM
> Subject: Re: Octave's and Matlab's limitations
> On 11/21/2012 05:08 PM, Sergei Steshenko wrote:
>>  Though I agree with you that typically more than one language is
>>  necessary, there is _nothing_ Matlab/Octave can do and other language
>>  can't with the same ease or even easier and more elegantly and less
>>  bug-prone.
> I'm pretty sure you underestimate the hold of matlab notation over
> matlab users.
> Sure this:
> ''=~('(?{'.('-)@.)@_*(address@hidden@/)(@)@-@),@(@@+@)'
> ^'][)@]`}`]()address@hidden@address@hidden@address@hidden@%[').',"})')
> scares the crap out of everybody except hardcore perl hackers, but try
> weening them off JAPHs.
> -- 
> Dimitri Maziuk
> Programmer/sysadmin
> BioMagResBank, UW-Madison --
> _______________________________________________
> Help-octave mailing list
> address@hidden

I like Perl, and I do not write it this way. The example you gave is unfair in 
several respects:

1) it's a regular expression, which is a language in itself;

2) when regular expressions are written in other languages, the typically look 
even worse - because other languages demand from you escaping, say, quotes. 
Please see this:

address@hidden:~/junk> cat -n
     1  #!/usr/bin/perl -w
     3  use strict;
     4  use warnings;
     6  my $s = '"foo bar"';
     7  warn "\$s=$s";
     8  $s =~ m|"foo|; # the double quote is _not_ escaped
     9  warn "\$&=$&";
    12  $s =~ m|
    13         "foo # I want 'foo' with leading quote
    14         \s+  # followed by non-zero number of whitespaces
    15         bar" # followed by 'bar' with trailing quote
    16         |x;
    18  warn "\$&=$&";
address@hidden:~/junk> ./
$s="foo bar" at ./ line 7.
$&="foo at ./ line 9.
$&="foo bar" at ./ line 18.

and try to write it in other languages - most likely you'll have to escape '"'. 
I remember how _awfully_ regular expressions look in Java, for example.

3) Perl has _extended_ regular expressions, so one can comment their parts - 
see and example on lines #12..16.

So, poor readability of Perl programs is the result of bad programmers writing 

Also, have a look at -> , e.g.:

    * $PROCESS_ID 
    * $PID 
    * $$ 

    * $0 

, etc.

So, you can either grab examples from Perl obfuscating contests or learn how to 
write readable code in Perl - with the 'English' pragma it's even easier; your 
variables and subroutines names is your choice - Perl doesn't force you.


 one can see:

user_input = input("Who goes there? ")
print("You may pass, " + user_input)

- to me is _less_ readable than Perl.

The parenthesis is a drag; the necessity to use '+' for explicit concatenation 
is a drag.

If you read about Python forced indentation, people complain that absence of 
code blocks syntactic markers (like {...} in Perl/"C") make code refactoring 
error prone. I even saw an application temporarily adding some kind of markers 
to Python code in order to make refactoring easier.

Finally, true closures were introduced only in Python 3 - about 15 years later 
than in Perl, so Python kinda catches up ...


I found completely unreadable piece of Python code too.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]