Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Array.prototype.toString #36

Merged

Conversation

galpeter
Copy link
Contributor

JerryScript-DCO-1.0-Signed-off-by: Peter Gal [email protected]

@ILyoan ILyoan mentioned this pull request May 12, 2015
25 tasks
@galpeter galpeter force-pushed the array_prototype_tostring branch 4 times, most recently from 54d3a42 to a4fd8cd Compare May 14, 2015 07:54
@LaszloLango
Copy link
Contributor

@egavrin, @ruben-ayrapetyan can you review please? We need this for testing RegExp result.

*/

ecma_completion_value_t
ecma_op_object_prototype_tostring (const ecma_value_t this_arg) /**< this argument */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@galpeter ,
please move the module to jerry-core/ecma/builtin-objects component, as it is common part of several builtin's implementation.

You could name it as the following: 'ecma-builtiin-helpers.h' and 'ecma-builtin-helpers.cpp'.
Please, rename ecma_op_object_prototype_tostring to ecma_builtin_helper_object_to_string,
and reflect the fact that it is common part of several built-in routines in the comment with list of the several built-in routines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruben-ayrapetyan , so you mean I should list in the comment where the method is used? Currently I know only two of the use cases, but that could easily change in the future. Is it really needed to list all usage occurrences in the comments? (Or did I misunderstood something?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@galpeter , yes, I mean comment with list of call sites (names of calling functions).


Currently I know only two of the use cases, but that could easily change in the future

How would this occur? Are there any other ECMA-defined call sites of the algorithm?
Anyway, for me it seems better to list all usage occurrences for the function if they would somehow occur.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruben-ayrapetyan ,

Currently I know only two of the use cases, but that could easily change in the future

How would this occur? Are there any other ECMA-defined call sites of the algorithm?
Anyway, for me it seems better to list all usage occurrences for the function if they would somehow occur.

Simple way: I did not read the whole ECMA standard to see where it is used, as I didn't think that it is needed to have such information.

Question: Do we plan to have every function's commit contain the list of calling functions? What is the benefit?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. list for the function should be in the comment to the function, not in the commit's comment, as you've written (maybe by mistake?)
  2. no, this is specific case - built-in implementation helper that is significant part of a built-in routine's algorithm. it is better to describe why it was extracted, and one of the way do this - to list call sites.
  3. I hope, that the case of extracting built-in routines' parts would be very rare
  4. you can see that the practice to reference a function in comment to another function is already used in some engine parts where we consider it is useful and prevents misunderstanding.

So, not, we don't plan to have every function's comment to contain the list of calling functions,
but plan to have them for some specific cases, to improve code readability.

Update:
"3. I hope, that the case of extracting built-in routines' parts would be very rare" - I mean case of reusing the parts between implementation of different built-in objects.

@galpeter galpeter added this to the ECMA builtins milestone May 20, 2015
JerryScript-DCO-1.0-Signed-off-by: Peter Gal [email protected]
@galpeter galpeter force-pushed the array_prototype_tostring branch from a4fd8cd to c16e065 Compare May 20, 2015 14:19
@galpeter
Copy link
Contributor Author

@ruben-ayrapetyan, I've updated the pull request based on your suggestions.

@egavrin
Copy link
Contributor

egavrin commented May 20, 2015

@galpeter make push

@LaszloLango
Copy link
Contributor

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants