Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Dylan (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Extensibility== This whole concept might strike some readers as very odd. The code to handle <code>to-string</code> for a window isn't defined in <code><window></code>? This might not make any sense until you consider how Dylan handles the call of the <code>to-string</code>. In most languages{{which|date=June 2013}} when the program is compiled the <code>to-string</code> for <code><window></code> is looked up and replaced with a pointer (more or less) to the method. In Dylan this occurs when the program is first run; the [[Run time system|runtime]] builds a table of method-name/parameters details and looks up methods dynamically via this table. That means that a function for a specific method can be located anywhere, not just in the compile-time unit. In the end the programmer is given considerable flexibility in terms of where to place their code, collecting it along class lines where appropriate, and functional lines where it's not. The implication here is that a programmer can add functionality to existing classes by defining functions in a separate file. For instance, you might wish to add spell checking to all <code><string></code>s, which in C++ or Java would require access to the source code of the string class—and such basic classes are rarely given out in source form. In Dylan (and other "extensible languages") the spell checking method could be added in the <code>spell-check</code> module, defining all of the classes on which it can be applied via the <code>define method</code> construct. In this case the actual functionality might be defined in a single generic function, which takes a string and returns the errors. When the <code>spell-check</code> module is compiled into your program, all strings (and other objects) will get the added functionality.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)