Project

General

Profile

Design #576

Disallow juxtaposition for string literals?

Added by John Abbott almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Parser/Interpreter
Target version:
Start date:
25 Jun 2014
Due date:
% Done:

100%

Estimated time:
Spent time:

Description

Currently CoCoA-5 accepts juxtaposed string literals (i.e. separated by nothing or white space).

Can we remove this "feature? What was the original reason for wanting this? Is it still valid?


Related issues

Related to CoCoA-5 - Bug #182: Unescaped double quote inside superstringClosed2012-06-08

Related to CoCoA-5 - Slug #875: Interpreter is too slow reading a big polynomialIn Progress2016-05-03

Related to CoCoA-5 - Feature #1431: Juxtaposition of string literalsRejected2020-03-03

History

#1 Updated by Anna Maria Bigatti almost 10 years ago

Can we remove this "feature? What was the original reason for wanting this?

The original reason was to allow it because it exists in C/C++.
Was not a cocoa-4 valid syntax.
Remove it!

#2 Updated by John Abbott almost 10 years ago

  • Status changed from New to In Progress
  • Assignee set to John Abbott
  • % Done changed from 0 to 20

I believe the relevant source is in Parser.C lines 2095-2103 inclusive.
I'll try commenting out, and see if everything still works...

#3 Updated by John Abbott almost 10 years ago

  • % Done changed from 20 to 60

I tried; it compiled and all tests pass. Will test more tomorrow, and then check in.

#4 Updated by John Abbott almost 10 years ago

Here is a possible reason for wanting to allow juxtaposition of strings: if an input includes a very long string literal, that literal could be split over several lines. The unification of the literals occurs inside the parser -- there is no run-time cost (but then who would put a large string literal inside a loop???) unlike an explicit use of + to concatenate them at run-time.

However, I cannot think of any plausible situation where CoCoA-5 code might want to have very long string literals. Conversely, an input with very long integer literals is quite likely, but we have no mechanism for splitting those!

All in all, it really does seem to be a "useless" feature...

#5 Updated by Anna Maria Bigatti almost 10 years ago

All in all, it really does seem to be a "useless" feature...

and was not in CoCoA-4. It's a pointless exception.

#6 Updated by John Abbott almost 10 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 60 to 100

If there were any serious problems, they'd have come to light by now (almost 24 hours of testing!)
Closing.

#7 Updated by John Abbott almost 8 years ago

  • Related to Slug #875: Interpreter is too slow reading a big polynomial added

#8 Updated by John Abbott about 4 years ago

  • Related to Feature #1431: Juxtaposition of string literals added

Also available in: Atom PDF