I do not have much programming experience. But, for me, Stretch looks like something Hush.
- What can you do well?
- Can someone do something that can not do hash?
Stops are different from using Hemps in the following manner (besides how the code looks):
- A fixed set of structures, while you add a new key for a hash.
- If you do not know the name of the attribute you want to access the runtime, you will have to use
sendto access the feature, while a hash key I do not know unless there's any difference in the runtime. - In relation to calling a feature that does not exist on an example of a structure, the cause of a non-mode arrow will be, while receiving the value for a non-existent key only has a hash from zero Will return
- Two examples of different structures will never be equal even, even if Structs are of the same properties and the same values as the examples (i.e.,
Struct.new (: x) .new (42) == Struct.new (: x) .new (42)is incorrect, whileFoo = Struct.new (: x); Foo.new (42) == Foo.new (42)True.) - Returns an array of
to_amethod for strokes, whileTo_agives you a key-value-pair on a hash An array is found (where "pair" means "two elements element") - if
Foo = Struct.new (: X ,: y ,: z)you To make an example ofFoo.new (1,2,3)can be used as an example of thefooattribute name.
Then to answer the question: When you want to do objects with a known set of properties of the model, use the strokes. When you want to model an arbitrarily used model (for example, how often each word is in the string or mapping of the names of the full names etc. Certainly there is no job for any structure , Whereas a person has to model with name, age and an address is the perfect fit for person = string.New (name, age, address) ).
As a sidenote: The C stricts have nothing to do with Ruby Strings, so get yourself confused by Don.
Comments
Post a Comment