NoExport by-default
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start from the export-table generation logic and the existing attribute handling (the issue links swoole.com/aot/en/docs/no-export for current behavior). Decide how #[ExportAs] with and without a name maps onto the export table, then locate where public PHP functions/methods are collected at build time so they become excluded by default. Done looks like: a small test project where an unannotated function is absent from the export table, an #[ExportAs] function appears under its chosen name, and name-conflict errors surface clearly. Note this is a breaking-change proposal still open for maintainer decision, so confirm intent before coding.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi! First of all, thanks for such a cool project.
My suggestion is to disable all export of public PHP methods by default. The current behavior implies that a method is explicitly exported in the build unless specified otherwise: https://swoole.com/aot/en/docs/no-export
Instead, add the opposite attribute:
#[ExportAs] // "php_foo" (?) by defult
function foo(): void {}
#[ExportAs(name: 'exported_function_name')] // custom name
function foo(): void {}
Proposal Problems
-
- Changing behavior requires breaking BC
- Counterargument: This is not critical in the current 0.x release
- Counterargument: There have already been precedents of core's BC (behavior upon integer overflow).
-
- Name conflicts are possible (If user names are allowed).
- Counterargument: The code's author writes this attributes, so they have control over this and can fix any name conflict errors.
- Counterargument: In the case of conflicts with vendor code, an option could be added in the future to specify exactly which directories (or namespaces) should be considered when building the export table. For example:
# project.yml export: - app/ - vendor/some/any/
Winnings
-
- A more aggressive DCE could be used in the future, removing unnecessary global functions, classes, and methods from the build.
-
- Allow inlining even of public functions if the compiler deems it necessary or unless otherwise specified.
-
- Security (?): If code is distributed as part of a solution (so/dll/dylib/etc.), external software will not be able to access the internal implementation directly, since the export table is explicitly defined by the developer.
- Ngôn ngữ chính
- PHP
- Star
- 1.4k
- Fork
- 80
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 26
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của swoole/typephp
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của swoole/typephp
Issue tương tự
-
Messenger
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
symfony/symfony-docs#23237 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Documentation Feature: Financial
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
coollabsio/coolify#12127 ·
Maintainer thường phản hồi trong vòng 1 ngày