Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C16FF200CB4 for ; Tue, 27 Jun 2017 11:43:08 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C00E0160BE9; Tue, 27 Jun 2017 09:43:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 13D52160BDC for ; Tue, 27 Jun 2017 11:43:07 +0200 (CEST) Received: (qmail 55336 invoked by uid 500); 27 Jun 2017 09:43:07 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 55325 invoked by uid 99); 27 Jun 2017 09:43:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Jun 2017 09:43:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id AC1E81A0467 for ; Tue, 27 Jun 2017 09:43:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id OYOqIM-2kz5T for ; Tue, 27 Jun 2017 09:43:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 952F35F613 for ; Tue, 27 Jun 2017 09:43:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 039B2E0BDE for ; Tue, 27 Jun 2017 09:43:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 28D4B24124 for ; Tue, 27 Jun 2017 09:43:02 +0000 (UTC) Date: Tue, 27 Jun 2017 09:43:02 +0000 (UTC) From: "Dmitri Blinov (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (JEXL-229) Introduce new syntax for class literals: Class and Type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 27 Jun 2017 09:43:08 -0000 [ https://issues.apache.org/jira/browse/JEXL-229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16064557#comment-16064557 ] Dmitri Blinov commented on JEXL-229: ------------------------------------ The difference between a dedicated literal, like Class, and a functor classp("String") in my view is as the difference between literal {code} 1234.33B {code} and its functional equivalent {code} new ("java.math.BigDecimal", "1234.33") {code} the readability, compactness and parse-time checks, which is good for Q&A. The use case I'm after is to get away from now existing functors like {{isMap()}}, {{isCollection()}} {{isSet()}} and to come to more generic type checking. I have overloaded the {{=~}} operator to be used with right-hand {{Class}} instances by calling either Class.isInstance() for objects or Class.isAssignableFrom() for other Classes, for example {code} if (obj =~ klass) {code} so I think we can get along without introducing {{instanceof}} operator, but for the types, as they are very basic Java elements for scripting, like primitives, IMHO, it would be desirable to have a special language construct. > Introduce new syntax for class literals: Class and Type > ------------------------------------------------------------- > > Key: JEXL-229 > URL: https://issues.apache.org/jira/browse/JEXL-229 > Project: Commons JEXL > Issue Type: New Feature > Affects Versions: 3.1 > Reporter: Dmitri Blinov > Priority: Minor > > For the purpose of type checking in jexl, It whould be convenient to have some simple syntax for referring to class types, like Class or Type. Literal Class should refer to general classes, and literal Type should refer to primitive type classes. For literals Class it could be possible to specify partal class name, which should resolve to classes in basic packages like java.lang and java.util, for example. -- This message was sent by Atlassian JIRA (v6.4.14#64029)