From commits-return-9689-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Wed Nov 6 00:15:06 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 009D1180648 for ; Wed, 6 Nov 2019 01:15:05 +0100 (CET) Received: (qmail 3702 invoked by uid 500); 6 Nov 2019 00:15:05 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 3693 invoked by uid 99); 6 Nov 2019 00:15:05 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Nov 2019 00:15:05 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id E195B805E6; Wed, 6 Nov 2019 00:15:04 +0000 (UTC) Date: Wed, 06 Nov 2019 00:15:04 +0000 To: "commits@groovy.apache.org" Subject: [groovy-website] branch asf-site updated: formatting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <157299930486.16495.11093304705829694780@gitbox.apache.org> From: paulk@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: groovy-website X-Git-Refname: refs/heads/asf-site X-Git-Reftype: branch X-Git-Oldrev: 10b90ff5bb23ad465bcdff18491db33242ba8793 X-Git-Newrev: 77ca7e16307e815855a58a145fe1644a8ff4bcf9 X-Git-Rev: 77ca7e16307e815855a58a145fe1644a8ff4bcf9 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/groovy-website.git The following commit(s) were added to refs/heads/asf-site by this push: new 77ca7e1 formatting 77ca7e1 is described below commit 77ca7e16307e815855a58a145fe1644a8ff4bcf9 Author: Paul King AuthorDate: Wed Nov 6 10:14:52 2019 +1000 formatting --- site/src/site/wiki/GEP-12.adoc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/site/src/site/wiki/GEP-12.adoc b/site/src/site/wiki/GEP-12.adoc index bdde374..1009893 100644 --- a/site/src/site/wiki/GEP-12.adoc +++ b/site/src/site/wiki/GEP-12.adoc @@ -17,9 +17,16 @@ == Abstract: SAM coercion -SAM stands for Single Abstract Method. SAM coercion is here a Groovy style transformation of a +SAM stands for Single Abstract Method. +A SAM type is an abstract class or interface with a single abstract method. +SAM coercion involves transforming a `groovy.lang.Closure` instance into an object suitable for our SAM type. -A SAM type is an abstract class or interface with a single abstract method. The coercion can happen as part of an assignment or as the result of a method call. Since this transformation might be outside of the types provided by Closure itself, it can be more than a simple Java style cast. Closure becomes a kind of sub type to all SAM types. Groovy has other such transformations without explicit cast or asType usage, which are number object transformations as well as the conversion of GSt [...] +The coercion can happen as part of an assignment or as the result of a method call. +Since this transformation might be outside of the types provided by Closure itself, +it can be more than a simple Java style cast. +Closure becomes a kind of sub type to all SAM types. +Groovy has other such transformations without explicit cast or asType usage, +which are number object transformations as well as the conversion of GString to String. === Motivation Even before Java8 we had discussions about supporting different interfaces with Closure like Runnable and Callable.