bugGNU Octave - Bugs: bug #43272, Optional superfluous end*...

 
 

bug #43272: Optional superfluous end* statements

Submitted by:  CH <atcl>
Submitted on:  Sun 21 Sep 2014 02:53:10 PM UTC  
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Invalid Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  3.8.1 Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Sun 21 Sep 2014 08:57:33 PM UTC, comment #7: 

Thank you for the clarifications, I see these points. If such extension would have entered it had to be made without breaking existing code, such as by free string literals like Javascript does with "use strict"; ( http://www.w3schools.com/js/js_strict.asp ) to classify code.

CH <atcl>
Sun 21 Sep 2014 07:28:25 PM UTC, comment #6: 

In any case, white space has other meaning.

Michael Godfrey <godfrey>
Project Member
Sun 21 Sep 2014 07:21:44 PM UTC, comment #5: 

To my knowledge, Python is the only language that is using indentation as a syntax element (OK, maybe "Sass" and some Wiki markup languages, too).

Introducing this feature to Octave, it would break a lot of existing code (Octave + Matlab) that is coming with inadvertently "sloppy" code formatting.

Armin Müller <arm_in>
Sun 21 Sep 2014 06:31:57 PM UTC, comment #4: 

To me, it's not about readability.  I find Python style readable.  The issue is that we are targeting the language used by Matlab.  That language has END statements and whitespace is ignored in this context.  I see no simple way to mix and match the Matlab language syntax for statements like IF, FOR, WHILE, etc., with the Python syntax.  So I don't think this is a reasonable request and I'm closing this report.

John W. Eaton <jwe>
Project Administrator
Sun 21 Sep 2014 04:32:22 PM UTC, comment #3: 

Can you elaborate on why this is not as readable? Are you refering to a mixed use of indent and end?

If code-blocks are recognizable by indentation depth, it seems very structured and readable to me ( http://effbot.org/pyfaq/why-does-python-use-indentation-for-grouping-of-statements.htm ).

CH <atcl>
Sun 21 Sep 2014 03:32:45 PM UTC, comment #2: 

Not a good idea. Better if code is easily
readable.

Michael Godfrey <godfrey>
Project Member
Sun 21 Sep 2014 03:08:39 PM UTC, comment #1: 

The example should have looked like:

for a=1:n
___dothis(); # loop body ( are spaces)
dothat();     # outside loop

CH <atcl>
Sun 21 Sep 2014 02:53:10 PM UTC, original submission:  

Would it be possible to make the end* statements unnecessary for loops and conditional blocks by evaluating indentation depth (as python forces) ?
So, the end of a block is reached as soon as the indentation depth reduces, ie:

for a=1:n
   dothis(); # loop body
dothat();    # outside loop

CH <atcl>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by arm_in (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by atcl (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-09-21 jwe StatusNone => Invalid
        Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.5