help-octave
[Top][All Lists]
Advanced

[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 -- http://www.bmrb.wisc.edu
> 
> 
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave
>

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 re_example.pl
     1  #!/usr/bin/perl -w
     2
     3  use strict;
     4  use warnings;
     5
     6  my $s = '"foo bar"';
     7  warn "\$s=$s";
     8  $s =~ m|"foo|; # the double quote is _not_ escaped
     9  warn "\$&=$&";
    10
    11
    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;
    17
    18  warn "\$&=$&";
    19
    20
address@hidden:~/junk> ./re_example.pl
$s="foo bar" at ./re_example.pl line 7.
$&="foo at ./re_example.pl line 9.
$&="foo bar" at ./re_example.pl line 18.
address@hidden:~/junk>  
"

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 
it.

Also, have a look at http://perldoc.perl.org/English.html -> 
http://perldoc.perl.org/perlvar.html , e.g.:



    * $PROCESS_ID 
    * $PID 
    * $$ 

...
    * $PROGRAM_NAME 
    * $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.

...

In 
https://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_3/Print_version#Printing
 one can see:


print("Halt!")
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 ...


Regards,
  Sergei.




I found completely unreadable piece of Python code too.



reply via email to

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