| Programming > Java Advocacy > Idea for a new ... |
|
| << Topic |
< Post |
Post 1 of 2 Topic 2359 of 2423
|
Post > |
Topic >> |
Idea for a new computer language, tentatively called Context
by Roedy Green <see_website@[EMAIL PROTECTED]
>
Feb 29, 2008 at 01:50 AM
|
I find the my most common error is when I track something is several
forms: e.g.
1. string of HTML with entities
2. string of HTML with Unicode instead of entities.
3. HTML with any tags stripped.
4. HTML with comments stripped and spaces compacted
I often forget what form I have now, or which form I need for a given
context. I may forget whether I have already done a conversion, and
might inadvertently apply the conversion twice.
1. binary number
2. number as string
3. number as string with locale formatting.
1. date as epoch
2. date formatted various ways with timezone
The catch is you have to keep the variant value forms in sync when one
of the forms changes.. If you use lazy evaluation, this gets even
hairier.
Further you have to keep track to call the right methods to get the
form needed for a given context.
The rough I idea is I want to hand over this book keeping to the
language. You define the various forms and provide some conversion
methods. You then use the same name, no matter which form you want,
and most of the time, the compiler can pick the desired context
without having to mention it every time.
You could fake this to a certain extent in ordinary Java by making
each set of contexts and object with getters and setters and lazy
conversion logic inside. You still have to custom compose the logic by
hand.
Perhaps you could write a stomper to generate the code.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


|
2 Posts in Topic:
|
Roedy Green <see_websi |
2008-02-29 01:50:00 |
|
Roedy Green <see_websi |
2008-02-29 02:49:53 |
|
Post A Reply:

|