Do You Really Need the Human In the Loop?
Consider :
I ask:
Comment on the attached TCL code being used with S-Edit
proc tgl_port_lbl {} {
if { 0 == [expr [find port -scope selection -goto none -add -count] + [find netlabel -scope selection -goto none -add -count] ] } {
puts "Must select a port or label"
return
}
copy
delete
mode renderoff
set dsn [database design -active]
(Yes, there's more, but this is the part we need to focus on.. for now)
And the Sphinx says:
The selection check is functional, but a bit noisy
This works:
if { 0 == [expr [find port -scope selection -goto none -add -count] + [find netlabel -scope selection -goto none -add -count] ] } {
But it is more complicated than it needs to be. Since this is numeric comparison, it is fine, but readability would improve if the counts were broken out:
set nports [find port -scope selection -goto none -add -count]
set nlabels [find netlabel -scope selection -goto none -add -count]
if {$nports + $nlabels == 0} {
puts "Must select a port or label"
return
}
-add in the count calls may be unnecessary or even slightly confusing
Since you are only asking for -count, using -add suggests you care about cumulative selection state, but here you only care about the numeric result. It may still work fine, but semantically it muddies the intent.
Is that true? I'm all for efficiency. Short answer: no
Why? Because, if you run find ports without the -add, then, if you had both ports AND netlabels selected, you're going to end up with ONLY ports.
So, why do you need the human in the loop? Because this kind of proprietary TCL function is not widely available to train the GPT on. That's why.
Comments
Post a Comment