Comments (7)
Also would need to implement it for the enumerator/iterator wrappers in neo core.
from neo-vm.
Alternatively, just move the implementation of GetHashCode
to the primitive types.
from neo-vm.
I would also recommend making sure Equals
is implemented for all things that can be InteropInterface
, e.g. all of the state classes
from neo-vm.
Is there a specific scenario that you need this for?
In JavaScript, an array is serialized as a string as a key.
var a = [1, 2];
var o = {};
o[a] = 100;
alert(o["1,2"]);
So I don't see why it is necessary to implement these.
from neo-vm.
JavaScript also has a Map
class that we've implemented in neo-one which is supposed to function the same as the C# equivalent assuming no custom hash code or equals implementation - that is, references may be used as keys. E.g.
const a = new Map();
const b = [1, 2];
a.set(b, 'hello');
console.log(a.get([1, 2])) // -> undefined
console.log(a.get(b)) // -> 'hello'
from neo-vm.
I think it is still impossible to implement a JavaScript Map
.
console.log(a.get([1, 2])) // -> undefined
This line returns an undefined
, but in NeoVM it throws an exception.
neo-vm/src/neo-vm/ExecutionEngine.cs
Lines 748 to 752 in 1874219
from neo-vm.
@erikzhang we check if the map has the key before calling pickitem so that we have a chance to return undefined. This is blocking NEO-ONE TypeScript smart contracts, can we revisit implementing this?
from neo-vm.
Related Issues (20)
- Add 'utf8Size' opcode HOT 4
- Script checks are incomplete
- Can I integrate this vm in to my custom projects? HOT 1
- Efficient way to pass Map type to contract method? OpCode.PACKMAP? HOT 1
- Adapt code documentation of UNPACK opcode
- ReferenceCounter can become negative HOT 18
- Is this `MEMCPY` expected to push nothing to the stack?
- ScriptBuilder should have an emitPush overload that takes a ReadOnlySpan<byte>
- How to customize an interface in interoperation service layer HOT 3
- Presssure test on v3.3.0 cause execution failed HOT 1
- v3.3.0 need more than 30 hours for syncing mainnet even it's just about 1.7million blocks HOT 2
- What is the purpose of the second assert of this test? HOT 1
- Instruction pointer reading PUSHDATA4 operand size as *signed* int32 HOT 1
- Missing push in APPEND?
- EmitPush(bool) should convert stackitem to right type
- Buffer to Integer conversion inconsistency HOT 1
- Override GetString for Buffer/ByteString ? HOT 4
- Set Operation in a Get Function HOT 2
- Add Equatable for StackItem
- Problem trying to PICKITEM from ByteString and then CAT ByteString and a single Byte picked from ByteString HOT 6
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 neo-vm.