Py-dea: Streamline string literals now!

L

Lie Ryan

Why stop at pre-determined, literal delimiters? That's way too easy on
the parser, whether that parser is a computer or a person.

__string_delimiter__ = Ω # magic syntax; no quotes needed

x = ΩhelloΩ

__string_delimiter__ = # # that first # isn't a comment marker

x = # this isn't a comment; it's part of the string
this is a multi-line string
#

__string_delimiter__ = '' # the delimiter is delimited by whitespace
# now I can have comments, again, too

x = ''"hello"'' # now x contains two double-quote characters

I'm sure that the implementation is trivial, and it's so much easier to
write strings that contain quotes (not to mention how easy it is to read
those strings back later).

right and you can generalize this idea even further

__comment_marker__ = $
__string_delimiter__ = [#, %]
$ also, even further
__comment_marker_keyword = #__my_own_comment_marker__%
__my_own_comment_marker__ = [&, *]
__assignment_symbol__ = <-
__attribute_delimiter__ <- -> & for attributes *
__call_delimiter__ = [!,@]
l = []
l->append!5@

you're a genius!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,201
Latest member
KourtneyBe

Latest Threads

Top