Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.gnustep.bug > #4112

[bug #47618] NSPredicate: SELF implemented incorrectly

Path csiph.com!feeder.erje.net!2.us.feeder.erje.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!171.64.64.130.MISMATCH!usenet.stanford.edu!not-for-mail
From Niels Grewe <INVALID.NOREPLY@gnu.org>
Newsgroups gnu.gnustep.bug
Subject [bug #47618] NSPredicate: SELF implemented incorrectly
Date Mon, 04 Apr 2016 14:56:51 +0000
Lines 59
Approved bug-gnustep@gnu.org
Message-ID <mailman.8999.1459781818.843.bug-gnustep@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain;charset=UTF-8
X-Trace usenet.stanford.edu 1459781818 17215 208.118.235.17 (4 Apr 2016 14:56:58 GMT)
X-Complaints-To action@cs.stanford.edu
To Niels Grewe <thebeing+savannah@halbordnung.de>, bug-gnustep@gnu.org
Envelope-to bug-gnustep@gnu.org
X-PHP-Originating-Script 0:sendmail.php
X-Savane-Server savannah.gnu.org:443 [208.118.235.70]
X-Savane-Project gnustep
X-Savane-Tracker bugs
X-Savane-Item-ID 47618
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17
X-Apparently-From 93.211.240.163 (Savane authenticated user thebeing)
In-Reply-To
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From 2001:4830:134:6::a
X-BeenThere bug-gnustep@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNUstep programming environment <bug-gnustep.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-gnustep>, <mailto:bug-gnustep-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-gnustep>
List-Post <mailto:bug-gnustep@gnu.org>
List-Help <mailto:bug-gnustep-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-gnustep>, <mailto:bug-gnustep-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.gnustep.bug:4112

Show key headers only | View raw


URL:
  <http://savannah.gnu.org/bugs/?47618>

                 Summary: NSPredicate: SELF implemented incorrectly
                 Project: GNUstep
            Submitted by: thebeing
            Submitted on: Mo 04 Apr 2016 14:56:49 GMT
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

The SELF expression in NSPredicate is implemented in a way that only allows it
to be used as LHS or RHS expression in an NSComparison predicate. 

In particular, the following is legal under Cocoa:

  NSDictionary *a = [NSDictionary dictionaryWithObjectsAndKeys: 
    @"2", @"foo", nil];
  NSPredicate *p = [NSPredicate predicateWithFormat: @"SELF.foo <= 2"];
  [p evaluateWithObject: a];

The base implementation gives you:

Uncaught exception NSInvalidArgumentException, reason:
[GSEvaluatedObjectExpression-keyPath] should be overridden by subclass

You can even do more complicated expressions such as "bar[SELF.foo]", where
SELF is not a top-level expression in Cocoa.

The reason is that GSEvaluatedObjectExpression is created as a singleton, and
always returns itself from expressionValueWithObject:context:, and there is
some pointer equality checking in NSComparisonPredicate  to make it work for
the really simple case (self == 'foo'). That totally sounds like premature
optimisation to me, btw.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47618>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/

Back to gnu.gnustep.bug | Previous | Next | Find similar


Thread

[bug #47618] NSPredicate: SELF implemented incorrectly Niels Grewe <INVALID.NOREPLY@gnu.org> - 2016-04-04 14:56 +0000

csiph-web