From: Craig Ringer <craig@2ndquadrant.com>
To: systemtap@sourceware.org
Subject: Typed locals in functions and probes? Feasibility of language enhancement?
Date: Tue, 21 Jul 2020 10:48:37 +0800 [thread overview]
Message-ID: <CAMsr+YGv1wWciZDs6DC6md2HuJq7wAJ424uvFsfdS-v4eVRgfw@mail.gmail.com> (raw)
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
next reply other threads:[~2020-07-21 2:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-21 2:48 Craig Ringer [this message]
2020-08-20 23:17 ` Frank Ch. Eigler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMsr+YGv1wWciZDs6DC6md2HuJq7wAJ424uvFsfdS-v4eVRgfw@mail.gmail.com \
--to=craig@2ndquadrant.com \
--cc=systemtap@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).