macros (was: Seeking computer-programming job (Sunnyvale, CA))
pjb@informatimago.com (Pascal J. Bourguignon) writes:
Well at that point I can only say that, well over here we're not (all)
raving maniacs, that we have useful tools that help solve or obviate a
lot of problems found with other programming languages, and point to
that tutorial: http://www.lisperati.com/casting.html
Assume for a moment I had advanced macro capabilities in Java.
I'd write:
public static String getMultiValue( Object valueObject )
{ String result = null;
if( valueObject == null )result = null;
else if( StringValue stringValue =? valueObject )
result = getStringValue( stringValue );
else if( SprayValue sprayValue =? valueObject )
result = getSetValue( setValue );
return result; }
The macro here is marked by the occurence of ?=??, which is
not a regular Java operator, but part of my hypothetical macro
call pattern.
The problem here is readability:
Can others know, what ?=?? means in my macro package?
Can they know how to immediately find its documentation?
If I invent and use this macro now, will even I myself
remember its meaning a year later?
The same coded in Java without macros /is/ more verbose,
but also more readable to someone who knows Java:
public static String getMultiValue( Object valueObject )
{ String result = null;
if( valueObject == null )result = null;
else if( valueObject instanceof StringValue )
{ StringValue stringValue =( StringValue )valueObject;
result = getStringValue( stringValue ); }
else if( valueObject instanceof SprayValue )
{ SprayValue setValue =( SprayValue )valueObject;
result = getSetValue( setValue ); }
return result; }