-
-
Notifications
You must be signed in to change notification settings - Fork 379
[articles/mixin.dd] Add concatenation, statements, types, expressions #3209
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
Open
ntrel
wants to merge
6
commits into
dlang:master
Choose a base branch
from
ntrel:str-mix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6474f4a
[articles/mixin.dd] Add concatenation, statements, types, expressions
ntrel 75f2092
String mixins 'can be used in place of'
ntrel 00666ec
Add 'Domain Specific Languages' section
ntrel 3355c37
Move 'Generating Declarations' section to top
ntrel a98779b
Show output for mixin statement
ntrel afd699b
Fix missing NOTE macro
ntrel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a fan of this example. JavaScript is a general purpose programming language, a DSL is something like regex or SQL. Implementing
convertJS
would be a huge undertaking, and it doesn't reflect a real use case (or at least I don't see it). Why would you write this, instead of translating the JS offline and putting the result in your .d file?I suggest using pegged as an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why any of that really matters. If the reader can't discern "real use cases" from a demonstrative example then they're not going to get anything from any example.
Besides, JavaScript did literally start as the ultimate domain specific language a long time ago.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mixins are a confusing feature, and their working / purpose are easily misunderstood. Consider the target audience for these articles: they're programmers who are new to D and might not have done any meta-programming beforehand. When you tell "
mixin("int y;")
is equivalent toint y;
" the first question is "what doesmixin
do then?".The specification can be very dry in its explanations, but the article should help programmers understand what actual problems the feature solves. There's a tendency of new D users to complicate things with
mixin
when regular functions could be used, which is not helped by poor official examples.