8000 Update 0000-function-api.md · vuejs/rfcs@adefea6 · GitHub
[go: up one dir, main page]

Skip to content

Commit adefea6

Browse files
authored
Update 0000-function-api.md
1 parent 05530ec commit adefea6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

active-rfcs/0000-function-api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -680,13 +680,13 @@ Here ` 9A0C Value` is the exposed type for value wrappers - it accepts a generic argum
680680

681681
# Drawbacks
682682

683-
- Makes it more difficult to reflect and manipulate component definitions.
683+
### Runtime Reflection of Components
684684

685-
This might be a good thing since reflecting and manipulation of component options is usually fragile and risky in a userland context, and creates many edge cases for the runtime to handle (especially when extending or using mixins). The flexibility of function APIs should be able to achieve the same end goals with more explicit userland code.
685+
The new API makes it more difficult to reflect and manipulate component definitions. This might be a good thing since reflecting and manipulation of component options is usually fragile and risky in a userland context, and creates many edge cases for the runtime to handle (especially when extending or using mixins). The flexibility of function APIs should be able to achieve the same end goals with more explicit userland code.
686686

687-
- Undisciplined users may end up with "spaghetti code" since they are no longer forced to separate component code into option groups.
687+
### Spaghetti Code in Unexperienced Hands
688688

689-
I've seen this concern raised a few times in the Class API thread and internally. However, I believe this fear is unwarranted. It is true that the flexibility of function-based API will theoretically allow users to write code that is harder to follow. But let me explain why this is unlikely to happen.
689+
Some feedbacks suggest that undisciplined users may end up with "spaghetti code" since they are no longer forced to separate component code into option groups. I believe this fear is unwarranted. It is true that the flexibility of function-based API will theoretically allow users to write code that is harder to follow. But let me explain why this is unlikely to happen.
690690

691691
The biggest difference of function-based APIs vs. the current option-based API is that function APIs make it ridiculously easy to extract part of your component logic into a well encapsulated function. This can be done not just for reuse, but purely for code organization purposes as well.
692692

0 commit comments

Comments
 (0)
0