Language features: mixins
"Edward L. Gow" <[email protected]> Tue, 30 Nov 2004 12:03:16 -0800
| Newsgroups | gmane.comp.java.beanshell.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm puzzled about importObject(). As Patrick described, it seems to behave like the 1.5 "import static". It makes the methods and attributes of an instance available without requiring a qualifying reference to the instance in the scope to which the importObject() applies. This does not seem like mixins to me. My understanding of mixins is providing the functionality that an object supports in its external interface via composition of instances of objects that provide part of the interface. The best example I've seen of this in the java world is the "Jamie" preprocessor, which seems to have disappeared. Beanshell's importObject() doesn't support exporting the interface of the imported object. Is there something in the works that will do this? -----Original Message----- From: beanshell-developers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org [mailto:beanshell-developers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of beanshell-developers-request-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Sent: Monday, November 29, 2004 8:02 PM To: beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Subject: Beanshell-developers digest, Vol 1 #277 - 1 msg Send Beanshell-developers mailing list submissions to beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/beanshell-developers or, via email, send a message with subject or body 'help' to beanshell-developers-request-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org You can reach the person managing the list at beanshell-developers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beanshell-developers digest..." Today's Topics: 1. RE: language extensions? future direction? (Yemi D. Bedu) --__--__-- Message: 1 Subject: RE: [Beanshell-dev] language extensions? future direction? Date: Mon, 29 Nov 2004 19:19:58 -0500 From: "Yemi D. Bedu" <yemi-DnQzskBZRmpWk0Htik3J/[email protected]> To: "Patrick Niemeyer" <[email protected]> Cc: <beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org> Hello, I was wondering in such a case as the "macros" would that allow for = memory of how an operator worked in parent or peer code. Something like = if to classes are instanced, would they have there own version of the = syntax tree and know the "for" or "while" loop will actually work as = expected. That would seem to heavily bloat memory use for many small = scripts running and even possibly slow its performance a tad on loading = and changing execution against a syntax tree. -----Original Message----- From: beanshell-developers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org = [mailto:beanshell-developers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of = Patrick Niemeyer Sent: Friday, November 26, 2004 8:24 PM To: Victor Volle Cc: beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Subject: Re: [Beanshell-dev] language extensions? future direction? On Nov 26, 2004, at 5:37 AM, Victor Volle wrote: > 1. "blocks" like in Ruby or Smalltalk: A code block that is used as > a parameter of a function, which the function then might call. > Ruby'ish example: Hi, we have discussed adding blocks in some way to the language and=20 I've posted some speculative emails about syntax to the list... Blocks=20 in some form would be useful and I'm sure we'll add them after the=20 current version is stable... whenever that is ;) > 2. "mixins" Yes, multiple inheritance is dangerous, and mixins > introduce a kind of multiple inheritance, but they come in handy > when needed. Imagine that you have multiple classes, that must > implement an Observer interface, but you can not use a common I'm not sure if it's sufficient, but in 2.x we've added a mixing=20 capability called importObject() that parallels the Java 1.5 static=20 import functionality but for instance methods and vars... I think this=20 is what you want. > 4. "macros" =E0 la Lisp. I never really liked Lisp, but one feature > was really great: The macro mechanism as part of the language. > (In Smalltalk you could do similiar stuff, when I remember I'm not sure in it's current incarnation BeanShell's grammar parsing is=20 sufficient to allow such things... There is currently all kinds of=20 opportunity though to add hooks to the built in language features...=20 I'm thinking of things like a hook to execute arbitrary code in place=20 of the current ASTs (syntax elements) or to trigger things on variables=20 changing, etc... more procedural stuff related to the current=20 language. To really make the grammar dynamic is an interesting topic=20 and something I've looked at a lot in the past... but probably not a=20 good addition to BeanShell any time soon... might be another project. =20 But I'm open to hearing ideas. Again, the people on the list would get very upset at the idea of=20 adding much new stuff before getting the current version solid and bug=20 free ;) Pat ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.=20 http://productguide.itmanagersjournal.com/ _______________________________________________ Beanshell-developers mailing list Beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/beanshell-developers --__--__-- _______________________________________________ Beanshell-developers mailing list Beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/beanshell-developers End of Beanshell-developers Digest ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/