From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by sourceware.org (Postfix) with ESMTPS id 260053857C4C for ; Tue, 21 Jul 2020 02:48:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 260053857C4C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=2ndquadrant.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=craig.ringer@2ndquadrant.com Received: by mail-lf1-x141.google.com with SMTP id y18so10812875lfh.11 for ; Mon, 20 Jul 2020 19:48:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=UXVpUDrgYdGr0/CSTohfrITjz4e9RmxKgwFwxoBuQnI=; b=aef30WHjvmYggA+vyPXIOJsevSS861WX9YfbLscekek90xLpcxoYkAjZOkhFo64vdE poL40TZ/gbuDGR2Ap3bABOO38UWVgLhndLcAQLFeDCWwUidAMtDTWoivMiBec4VIQeFv UjYHSHPZRMEN2YbeJMKyn7NZ7DOlpOFJVe6YpJsZ9GOQNUU29izYE9G8qYawIH85culG qjjh1Ny3yuBmg3uSU8iCB+e/GyxUSTWojOhh0eyjQh5cdFSB6XCabZ11t2Rxn1bx75kH eT4bORhUj6RXcMIHu6CQDeO8PiYNWIzRwyr9KN80g64IVZwJ1LqSwA90ytHQAnBqzitS w3Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=UXVpUDrgYdGr0/CSTohfrITjz4e9RmxKgwFwxoBuQnI=; b=Z3s3zr7YafHUKmdxytqEqd8x8UWMTFMBFkkUQsWnf+Brm+r0mDvwWW4rMyST1N1ERs ALG+mUTF26FQie5GyYpEVq1HjaBmWpMs5SM1p1EgIgO73/r/tFwxjdgiI51UY8rocHqF rlrBMLbYeoz2qfpu14AJZ1MfqLMQsB4HunzmhL8qGqsrRKnztfns6IYIRGLds2KyvkZj l0C+gtOIDUBv5k1jxy9OEIG6BbnXYe6shcn0/Qjlt8FRejMAOsIkjGeItPA/24SzRyBl CUFocvvqIXbPPBb0jiju65xuXLfCKL4eWXn3sl3RfcoSb7EaE4YFaBtcK4WrGFtUEe1e y+GQ== X-Gm-Message-State: AOAM531RmZ0n26m3h4+0qJWFKIclQugDEVU612EvNAno+XA97BA1/aHJ Snxxu41ReFMs9iQIr6SaJxrA1IwU3WyEvYey8VCGoUDCChJBKw== X-Google-Smtp-Source: ABdhPJy/KOtA/Cjmwdm9RbtULBOBibJMz1qBNyC6K33Le/zfwtqbVk8Ojv5I0HE6x1sIz2gPCSpQC5PY+t6612Dmp54= X-Received: by 2002:a19:cc9:: with SMTP id 192mr9361841lfm.61.1595299728258; Mon, 20 Jul 2020 19:48:48 -0700 (PDT) MIME-Version: 1.0 From: Craig Ringer Date: Tue, 21 Jul 2020 10:48:37 +0800 Message-ID: Subject: Typed locals in functions and probes? Feasibility of language enhancement? To: systemtap@sourceware.org X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jul 2020 02:48:51 -0000 I find that I write things like this a lot: if (foo && (@cast(foo)->bar) return @cast(foo)->bar->baz Because systemtap type-erases locals to long or string, code for member access gets repetitive fast. I can @define macros for shorthand, but that only goes so far, and it obfuscates the code a bit. Is there an accepted pattern for this that I'm missing? If not, how feasible would it be to track inferred types for locals? Definitely NOT for globals, just for locals within a function? Could it be relatively low hanging fruit to implement this, something folks here might be able to point me in the right direction for? Or is it a major language change that's in the too hard basket? -- Craig Ringer http://www.2ndQuadrant.com/ 2ndQuadrant - PostgreSQL Solutions for the Enterprise