public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Typed locals in functions and probes? Feasibility of language enhancement?
@ 2020-07-21  2:48 Craig Ringer
  2020-08-20 23:17 ` Frank Ch. Eigler
  0 siblings, 1 reply; 2+ messages in thread
From: Craig Ringer @ 2020-07-21  2:48 UTC (permalink / raw)
  To: systemtap

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-20 23:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21  2:48 Typed locals in functions and probes? Feasibility of language enhancement? Craig Ringer
2020-08-20 23:17 ` Frank Ch. Eigler

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).