Re: [morph-developer] Damn Verizon
Brought to you by:
orangeherbert,
sgarlatm
|
From: Matt B. <gud...@ya...> - 2007-04-05 19:14:13
|
--- Matt Sgarlata
<Mat...@wh...> wrote:
> Comments inline....
> > :) I think making expressions perfectly safe for
> this
> > copier will require more knowledge of how the
> > expression is parsed, along the lines of my
> > earlier-voiced thoughts about expressions in
> Morph.
> > Maybe I'll try to cook up a BC implementation of
> this.
> >
> One of my original frustrations with BeanUtils is
> when it encountered
> something unexpected it would blowup at you and ruin
> your day. With
> Morph I strove to just silently fail where possible
> and only throw
> exceptions when something really boneheaded happened
> (like trying to
> convert "hello world!" to an Integer).
>
> I'm pretty sure what will happen if you enter a
> totally bogus expression
> is you'll get a blowup. If you enter an expression
> for an object path
> and a null is encountered part way through, I'm
> pretty sure a null will
> just be returned.
>
> Don't be intimidated by the expression parsing
> stuff, it's really very
> trivial (in fact SimpleExpressionParser has less
> than a dozen lines of
> code). Basically the expression parser is just a
> StringTokenizer that
> looks for symbols usually found in languages like .
> [ ] ( ) and then
> just treats them all as word breaks. So
> something.funky]like[this in
> Morph is equivalent to something.funky.like.this in
> a more strict
> language like JSTL. Why be so strict with your
> syntax when the whole
> point of this new syntax (as opposed to strongly
> typed Java calls) is to
> ignore types and make things easier on yourself? ;)
>
I'm not sure... I understand what you're saying, but
somehow I can't rid myself of this feeling that _some_
structure might be a good thing. I'll let you know if
I come up with anything concrete. In the meantime I
still can't see the harm in refactoring some things
while retaining the SL functionality... :)
> Then for the Language implementation we just
> traverse the object graph
> in a loop and try our best to get what was
> requested:
>
> public Object getImpl(Object target, String
> expression) throws Exception {
> if (ObjectUtils.isEmpty(expression)) {
> return target;
> }
>
> Object value = target;
>
> String[] tokens =
> expressionParser.parse(expression); // {
> "something", "funky", "like", "this" }
> for (int i=0; i<tokens.length; i++) {
> String token = tokens[i];
> if (value == null) { // just return null, no
> blowup
> return null;
> }
> value = getReflector().get(value, token); //
> yay found
> something! go get it
> }
>
> return value;
> }
>
> > Oh, and I forgot to say before that yes, I will
> > probably be grateful for help with jots and
> tittles
> > wrt the release. And just to be sure we're on the
> > same page, we're talking 1.0.1, correct?
> >
> Actually I released 1.0.1 last year but never
> updated the homepage since
> it's such a huge PITA. Next could be 1.0.2 but even
> if it's still in
> the sandbox your new stuff might merit a 1.1
> designation ;) Up to you...
Ah, didn't even see that. Maybe 1.0.2 until DSL
leaves sandbox, meaning that if we determine it's
already ready for prime time we can go 1.1?
-Matt B
>
> Matt S
>
>
-------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get
> the chance to share your
> opinions on IT & business topics through brief
> surveys-and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> morph-developer mailing list
> mor...@li...
>
https://lists.sourceforge.net/lists/listinfo/morph-developer
>
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news
|