Typed locals in functions and probes? Feasibility of language enhancement?

Craig Ringer craig@2ndquadrant.com
Tue Jul 21 02:48:37 GMT 2020


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


More information about the Systemtap mailing list