Re: [Anima] GRASP API in C?

Brian E Carpenter <brian.e.carpenter@gmail.com> Fri, 24 March 2017 20:02 UTC

Return-Path: <brian.e.carpenter@gmail.com>
X-Original-To: anima@ietfa.amsl.com
Delivered-To: anima@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 627CF12708C for <anima@ietfa.amsl.com>; Fri, 24 Mar 2017 13:02:26 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.7
X-Spam-Level:
X-Spam-Status: No, score=-2.7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z3yEkEQmc6_Q for <anima@ietfa.amsl.com>; Fri, 24 Mar 2017 13:02:24 -0700 (PDT)
Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 00FD6126BF0 for <anima@ietf.org>; Fri, 24 Mar 2017 13:02:23 -0700 (PDT)
Received: by mail-it0-x22f.google.com with SMTP id y18so20121518itc.0 for <anima@ietf.org>; Fri, 24 Mar 2017 13:02:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=BHYs+f5QHlCyruJSuVa9FSsbXAuNIcbeQjo4MGRFR1U=; b=Y+NTI7RHgBQCj3YRxXxuXjejAoXvgIo8FYzxEBYw6vijsRh5efZEyLFznYUZx2Sy4R 5QLsV8lILAOx/a5FKzJiOTKbM+q+HQMr9jEAziutR04gxdJmhssDcPeD4srLWaV8wH54 JL6raAwr+72Hjjnbagw3YK4J95a1eaR6j/5ppDfZVCo1tSpmZ8CF5zRdptnGVhBkPw3B Mx/hscLEWHYxS0mprGqPbHQu13Rlv0xtwq6nTt9SbjTl/eLWHXaHO3bWK/eoPVVD+mxb 1tvmBHsjpddHyMt9JxFtkcPtJY/cX96U7fVAsxDtdmZnImMkp9gXasKbkgduXc8iMKHb vNBg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding; bh=BHYs+f5QHlCyruJSuVa9FSsbXAuNIcbeQjo4MGRFR1U=; b=q2zxr9RFuCbOgAkb2jYknqpzdtBMmoH5zQS3Q92jTrenNg0m6GAs4oQLV9CCIzuRsW T9lsdlb3DQLflL8SkiKC+nG67gjAIksHrwhLMn2epiG4vhPY1lddw0n8rp5qwbHtC5oE 1kErm+jZfteqT6ROyuknrG4/pAGOKyY6+bAD/aJaT6OacwIZSPuE+4y/Pa9PJE4iBRQw RhSssj2HRwIpb+utTQ+sI8ps7GT5ve6Ueqmsm18Bm7dozJ4zV7rbCHkyFfhklEyLyOB5 oWAEt3+SBD197X3lGoXWKSgIIRvndFig+3DD2vIg0dWBUxGHzrit9U3+YUcQASZpEtfI vSyg==
X-Gm-Message-State: AFeK/H2MLBcjjAAkaP8LmWyTqREs6AWrDx7ztMdiLPYJJOJMja/DlMeo2E64Gr96v6YIIw==
X-Received: by 10.107.46.198 with SMTP id u67mr11007707iou.8.1490385743057; Fri, 24 Mar 2017 13:02:23 -0700 (PDT)
Received: from [172.16.11.95] (50-76-68-137-static.hfc.comcastbusiness.net. [50.76.68.137]) by smtp.gmail.com with ESMTPSA id 62sm2939247itl.1.2017.03.24.13.02.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Mar 2017 13:02:22 -0700 (PDT)
To: Michael Richardson <mcr+ietf@sandelman.ca>
References: <83c2beba-2ad5-eb1d-b188-fe2d9e688391@gmail.com> <9809.1490283823@obiwan.sandelman.ca> <76345f98-758c-49a1-f1cd-9bb50c3c757e@gmail.com> <18940.1490381204@obiwan.sandelman.ca>
Cc: Anima WG <anima@ietf.org>
From: Brian E Carpenter <brian.e.carpenter@gmail.com>
Organization: University of Auckland
Message-ID: <298db127-0970-68ee-dda6-0a9c0c625041@gmail.com>
Date: Sat, 25 Mar 2017 09:02:33 +1300
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <18940.1490381204@obiwan.sandelman.ca>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/anima/B2gjWYdIYzJX9GDM0Lu_ad8ANFQ>
Subject: Re: [Anima] GRASP API in C?
X-BeenThere: anima@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Autonomic Networking Integrated Model and Approach <anima.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/anima>, <mailto:anima-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/anima/>
List-Post: <mailto:anima@ietf.org>
List-Help: <mailto:anima-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/anima>, <mailto:anima-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 24 Mar 2017 20:02:26 -0000

On 25/03/2017 07:46, Michael Richardson wrote:
> 
> Brian E Carpenter <brian.e.carpenter@gmail.com> wrote:
>     >> Brian E Carpenter <brian.e.carpenter@gmail.com> wrote: > Hi,
>     >>
>     >> > We will discuss the GRASP API >
>     >> (https://tools.ietf.org/html/draft-liu-anima-grasp-api-03) in Chicago.
>     >>
>     >> > One related topic is how to map this API into C, which is perhaps
>     >> the > most fundamental mapping.
>     >>
>     >> As someone who writes lots of C, I am not convinced this is a useful
>     >> exercise.
> 
>     > Can you explain? If you're arguing that no ASAs will be written in C,
>     > that's defensible, but maybe that isn't your argument?
> 
> I think that ASAs that are written in C will be written in that language for
> reasons of extreme constraints. As such, they won't bother with a
> library/API.  It will all be statically initialized globals and other stuff.
> (Go read the Contiki code for an example of what I mean...)
> 
> Everyone else will write their ASAs in a higher level language: python, ruby,
> perl, java, scala, *go*, maybe rust.   The really hard thing about the C api
> is that doesn't deal well with indefinites like intents...

It doesn't deal well with flexible types either, a dangerous luxury in Python
that I've got very fond of. But it seems to me that if a GRASP core implementation
is written in C for efficiency, it will *need* to offer an API in C that higher
level languages can build on.

And if we are happy with a core written in a high level language, we'll
need to call it from other languages. That can be complicated too.

BTW, my not-production-quality Python version of the GRASP core is now 
about 1800 lines of code, but if we take out the stuff for diagnostics and
debugging there's maybe 1000 lines. I hope we'll find out in the hackathon
how big the BUPT code is; so far they don't support an API, so they are
on your model.

    Brian