Wiki

Ticket #341 (new enhancement)

Opened 11 years ago

Last modified 11 years ago

Require (some) binary operators to have spaces around them

Reported by: hopscc Owned by:
Priority: medium Milestone:
Component: Cobra Compiler Version: 0.9.4
Keywords: Cc:

Description

In the interests of having canonical formatting in expressions, force some (subset) of the binary operators to only be accepted when have spaces around them
e.g

# wrt ASSIGN(=) 
#rather than accepting
name= a.b.foo
# or
name =a.b.foo

# Only allow
name = a.b.foo
#must have at least one space fore and aft around the =

Discussion  Require spaces around Binary ops

Subset should probably include

  • math operators ( +,-,*, /, **, %)
  • Assignment(=) and (perhaps equals (==) )
  • nil and nonnil coalesce (? and !)
  • Others?...

This is a reasonably major change so should probably be compiler suppressible.

Attachments

spaceWrap.patch Download (2.4 KB) - added by hopscc 11 years ago.

Change History

Changed 11 years ago by hopscc

Changed 11 years ago by hopscc

require spaces on ASSIGN and EQ.
(Apply this patch in the cobra Source directory)

Extend as desired to test effect with other operators...

Changed 11 years ago by Charles

related to ticket:339 "Provide a nil safe dereference operator"

Note: See TracTickets for help on using tickets.