Comments (15)
This is expected behaviour. "get" returns a list of requested fields.
Try this:
positions share set moo {1234 5678 23423}
positions share set woof 1234
positions share get moo woof
ok {{1234 5678 23423} 1234}
You're being led astray by the fact that the printable form of a single-element list is the same as the first element.
from speedtables.
Make "share get" not introduce extra list around the value if it is already a list and only one value is being requested.
[master 38f110c] Make "share get" not introduce extra list around the value if it is already a list and only one value is being requested. (issue 12)
3 files changed, 41 insertions(+), 2 deletions(-)
from speedtables.
hmm, didn't see your post before I committed... Let me consider that.
from speedtables.
I did notice that "share get" allows requesting multiple values when I was making my fix. My above commit makes it return a single value if you are requesting only one variable, or the old behavior if requesting 2 or more values. What do you think about that?
from speedtables.
Changing it will break any existing code that uses the idiom [lindex [$table get key] 0]. I know I've written code that uses it. None of my code that does is live any more, but I would be surprised if there was no code in all of Flightaware that used it.
from speedtables.
Karl and I have discussed this before and decided that the existing behavior was less surprising than having the result change from an element to a list depending on the number of elements requested.
from speedtables.
Actually, FA doesn't use any other shared memory speedtables currently. I can change it back if we think it's better that way though... It just seemed more convenient to avoid needing to use lindex/lassign if you're only requesting one variable.
from speedtables.
You're not just changing shared memory ctables. This change effects all ctables code, and also needs to be changed in master-server ctables and stapi.
from speedtables.
It also creates an inconsistency between "table get" and "table search -get".
from speedtables.
okay you have some good arguments, so I've restored the original behavior.
However, I don't seem to actually be able to use "share get" for a non shmem table. It always returns empty string.
package require speedtable CExtension bullseye 1.0 { CTable Barn { varstring alpha varstring beta indexed 1 varstring delta varstring gamma } } package require Bullseye Barn create mybarn mybarn share set alpha alfa if {[mybarn share get alpha] != [list "alfa"]} { error "mismatch1" } mybarn share set beta "bovo bravo" if {[mybarn share get beta] != [list "bovo bravo"]} { error "mismatch2" } mybarn share set delta deltalina gamma "gamma gamma gamma" if {[mybarn share get gamma] != [list "gamma gamma gamma"]} { error "mismatch3" } if {[mybarn share get beta delta] != [list "bovo bravo" "deltalina"]} { error "mismatch4" }
from speedtables.
Aha, I get it! I'm mixing up "share get" with "get". You're right, the "share" command is only there for shared memory ctables. It should be an error for everything else.
How are you using "share set" and "share get"? What are you using them for?
from speedtables.
Anyway, for the "share get" command, I don't see anything that would actually break with your change, but it's a change that makes me nervous.
from speedtables.
On further thought I would be happier making "share get" not even accept more than one argument, rather than break the symmetry of a list and a single value.
from speedtables.
good point. I've made a commit to make all "share" commands now return error rather than silently doing nothing:
[master 64f322e] make "share" commands return error (not TCL_OK) when invoked on a non-shared table.
1 files changed, 4 insertions(+), 2 deletions(-)
I'm using the "share set/get" for communicating the last replayed timestamp from the master to the readers. This works well for small variables that are not complex enough to warrant a dedicated speedtable.
I think I will change "share get" to only accept one argument, and then add a "share multiget" to let you specify multiple arguments and get the old behavior...
from speedtables.
[master a1e1a50] make "share get" accept only one argument, add "share multiget" for multiple arguments and returning a list. (Issue 12)
4 files changed, 91 insertions(+), 16 deletions(-)
from speedtables.
Related Issues (20)
- _dirty field not automatically updated HOT 2
- speedtable thread safety HOT 2
- tclobj HOT 3
- cpp branch will build and install even if boost-libs not present
- Reimplement support for flags to mmap (nosync nocore) HOT 3
- speed tables doesn't work with clang and other non-GCC compilers HOT 10
- ckalloc no longer returns char* in tcl8.6 HOT 2
- Mapped file base address is not honored HOT 3
- compilation issues on Ubuntu HOT 3
- speedtables startup locking sometimes fails to provide mutual exclusion / fails outright HOT 4
- stapi::refresh_ctable doesn't rewrite the TSV cachefile HOT 6
- stapi::refresh_ctable does not clear the initial table if no time column is provided HOT 5
- stapi::refresh_ctable does not handle SQL generation errors HOT 5
- More than one call to stapi::init can confuse existing speedtables HOT 5
- search with match against integer fields will crash HOT 6
- search -code with return statement does not stop proc execution HOT 17
- search fails to fully unset the data in the data array for each loop HOT 30
- Using a speedtable shared library from two interpreters in the same process leads to a crash HOT 1
- Incompatibility between compare "in" operator in native speedtables versus stapi-based postgres version HOT 2
- Pacakge versions for 1.13.18 say 1.13.17 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from speedtables.