Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.ada

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-07-2012, 08:14 PM
Patrick
Guest
 
Posts: n/a
Default ada without ada libraries?

Hi Everyone

I just got my compiler set up the way I want it and I am ready for my
first ada project.

I have spent sometime with lua. Lua's library support is terrible but
lots of people love the language. Many people just build a rough
skeleton application in C and call it from lua.

Lua handles all the type checking and much of the logic in this
arrangement and C is mostly just library code.

Would this same approach seem logical for ada? -Patrick
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 02-08-2012, 01:04 AM
BrianG
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

On 02/07/2012 04:14 PM, Patrick wrote:
> Hi Everyone
>
> I just got my compiler set up the way I want it and I am ready for my
> first ada project.
>
> I have spent sometime with lua. Lua's library support is terrible but
> lots of people love the language. Many people just build a rough
> skeleton application in C and call it from lua.
>
> Lua handles all the type checking and much of the logic in this
> arrangement and C is mostly just library code.
>
> Would this same approach seem logical for ada? -Patrick


This might make sense, if you're claiming that Ada's "library support is
terrible"; else, why would you make this comparison? It sounds like you
want to use Ada, but not use the Ada libraries.

If you instead want to use Ada with a library for which you don't have
an Ada interface, you can build (or look for) a binding to that library.
This is done in Ada, not in another language. See the Ada packages
Interfaces.*. Typically, you don't need to program in anything except
Ada - that way, you get Ada's protection (to the extent possible) in
with binding, just not within the library itself.

--
---
BrianG
000
@[Google's email domain]
..com
Reply With Quote
  #3 (permalink)  
Old 02-08-2012, 02:11 AM
Gautier write-only
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

Hi!

Typically a script language (for instance Lua) needs a compiled one
(here, C) to speak to the broader world. The interpreter, the run-
time, the library components, and so on are built with the compiled
language in order to have products in machine code (.exe, .dll in
Windows for instance).

Ada is a general-purpose, compiled language, so the relationship would
be different. You can make a whole standalone application fully in Ada
(with GUI, databases, number crunching, compression,...).
There is a broad standard Ada library that is very useful, it would be
silly to ignore it a priori just because of your experience with Lua!
Additionally, Ada can access numerous components written in classical
languages like Fortran or C via the Import pragma.

HTH
_________________________
Gautier's Ada programming
http://sf.net/users/gdemont
Reply With Quote
  #4 (permalink)  
Old 02-08-2012, 07:35 AM
tonyg
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

There are actually some very very useful ada librarys out there for
doing some amazing stuff. From the booch components to fuzzy logic all
written totally in ada.

I use em so I can stand on the extra wide shoulders of some of the
tremendous ada programmers out there.
Reply With Quote
  #5 (permalink)  
Old 02-08-2012, 08:10 AM
Simon Wright
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

Patrick <patrick@spellingbeewinnars.org> writes:

> I just got my compiler set up the way I want it and I am ready for my
> first ada project.
>
> I have spent sometime with lua. Lua's library support is terrible but
> lots of people love the language. Many people just build a rough
> skeleton application in C and call it from lua.
>
> Lua handles all the type checking and much of the logic in this
> arrangement and C is mostly just library code.
>
> Would this same approach seem logical for ada? -Patrick


It doesn't really seem logical for C! Perhaps I've misunderstood you.

I don't know Lua, but I do know Tcl, and the approach I've adopted is to
write the application engine, if you will, in Ada and the controls in
Tcl. The application engine can be very complicated, but the controls
are usually simple.

An example: this proc runs every 100 ms to see whether each of 4 lamps
should be lit or not. The Ada part of the app presents the function
getLampState which takes a string (the name of the lamp) and returns a
boolean (0 or 1, I expect) saying whether it should be lit. The GUI is
written in Tcl[/Tk], which it's good at, and the complex timing logic
about when the lamps should be lit is left to the Ada.

proc checkLampProc {} {
foreach l {a b c d} {
set s [getLampState $l]
if {$s} {
.c itemconfigure $l -fill yellow
} else {
.c itemconfigure $l -fill gray
}
}
after 100 checkLampProc
}
Reply With Quote
  #6 (permalink)  
Old 02-08-2012, 11:02 AM
Stephen Leake
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

Patrick <patrick@spellingbeewinnars.org> writes:

> Hi Everyone
>
> I just got my compiler set up the way I want it and I am ready for my
> first ada project.
>
> I have spent sometime with lua. Lua's library support is terrible but
> lots of people love the language. Many people just build a rough
> skeleton application in C and call it from lua.
>
> Lua handles all the type checking and much of the logic in this
> arrangement and C is mostly just library code.
>
> Would this same approach seem logical for ada? -Patrick


Yes; "Anything C can do, Ada can do Better"

Lua should be used for user scripting, not large-scale programming.

--
-- Stephe
Reply With Quote
  #7 (permalink)  
Old 02-08-2012, 12:07 PM
Dmitry A. Kazakov
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

On Wed, 08 Feb 2012 07:02:12 -0500, Stephen Leake wrote:

> Patrick <patrick@spellingbeewinnars.org> writes:
>
>> Would this same approach seem logical for ada? -Patrick

>
> Yes; "Anything C can do, Ada can do Better"
>
> Lua should be used for user scripting, not large-scale programming.


There is no scripting which should not be done in Ada. Even if it does not
appear so at first glance, it is.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Reply With Quote
  #8 (permalink)  
Old 02-08-2012, 08:10 PM
Patrick
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

Thanks Guys!

Hi Brian, Just to clarify, I was not bashing ada in any way. I am just
getting started and don't really know much of anything, I am not
criticizing libraries I have never used.

I was thinking of intertwining C and ada via import and export pragmas
and the fdump-ada-spec feature. I am just a little mixed up about
whether to write a little C beforehand or to do everything in ada.

Hi Gautier!

Your right, I should give the ada libraries a go first

Hi tonyg, good point, not being a giant ada programmer myself, this
makes sense

Hi Simon I definitely want to write everything I can in ada, not C,
thanks

Hi Stephan
"Anything C can do, Ada can do Better" , yep sure seems like it,
that's why I'm here

Hi Dmitry
I never really thought about ada scripting C but yes, through the
import/export pragmas I guess it really is, thanks
Reply With Quote
  #9 (permalink)  
Old 02-08-2012, 08:39 PM
Gautier write-only
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

There is also this:

https://github.com/io7m/coreland-lua-ada

Perhaps something to consider...

G.
Reply With Quote
  #10 (permalink)  
Old 02-09-2012, 01:08 AM
Shark8
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

On Feb 8, 7:07*am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Wed, 08 Feb 2012 07:02:12 -0500, Stephen Leake wrote:
> > Patrick <patr...@spellingbeewinnars.org> writes:

>
> >> Would this same approach seem logical for ada? -Patrick

>
> > Yes; "Anything C can do, Ada can do Better"

>
> > Lua should be used for user scripting, not large-scale programming.

>
> There is no scripting which should not be done in Ada. Even if it does not
> appear so at first glance, it is.
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de


HM -- That reminds me, I should re-try implementing a LISP interpreter
in Ada.
Reply With Quote
  #11 (permalink)  
Old 02-09-2012, 01:11 AM
Shark8
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

On Feb 8, 3:10*pm, Patrick <patr...@spellingbeewinnars.org> wrote:
> Thanks Guys!
>
> I was thinking of intertwining C and ada via import and export pragmas
> and the fdump-ada-spec feature. I am just a little mixed up about
> whether to write a little C beforehand or to do everything in ada.


That makes some sense. Were I you I'd go with the REALLY-THICK-BINDING
approach, where you put the C importing (and executing) into a package
Body with only nice (read Ada) interfacing in the Spec... using it
your
user should have no clue C is ever involved.
Reply With Quote
  #12 (permalink)  
Old 02-09-2012, 02:43 AM
Jeffrey Carter
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

On 02/08/2012 07:08 PM, Shark8 wrote:
>
> HM -- That reminds me, I should re-try implementing a LISP interpreter
> in Ada.


I think that's been done already, in Ada 83:

http://dl.acm.org/citation.cfm?id=33...TOKEN=58515799

--
Jeff Carter
"I'm a lumberjack and I'm OK."
Monty Python's Flying Circus
54

--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---
Reply With Quote
  #13 (permalink)  
Old 02-09-2012, 03:17 AM
Shark8
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

On Feb 8, 9:43*pm, Jeffrey Carter <spam.jrcarter....@spam.not.acm.org>
wrote:
> On 02/08/2012 07:08 PM, Shark8 wrote:
>
>
>
> > HM -- That reminds me, I should re-try implementing a LISP interpreter
> > in Ada.

>
> I think that's been done already, in Ada 83:
>
> http://dl.acm.org/citation.cfm?id=33...&CFID=65557217...
>
> --
> Jeff Carter
> "I'm a lumberjack and I'm OK."
> Monty Python's Flying Circus
> 54
>
> --- Posted via news://freenews.netfront.net/ - Complaints to n...@netfront.net ---


I see.
But there's also something to be said about doing something yourself
(I.E. a "Learning Project")
and, in addition to that, I'm interested in interpreters/compilers --
though to be perfectly honest,
I don't consider myself to be particularly GOOD at them as they
usually stop before they're up and
working. (Life getting in the way or losing interest for a while or
hitting a problem that I've no
clue on how to address or somesuch.)
Reply With Quote
  #14 (permalink)  
Old 02-09-2012, 07:34 AM
Dmitry A. Kazakov
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

On Wed, 8 Feb 2012 18:08:21 -0800 (PST), Shark8 wrote:

> On Feb 8, 7:07*am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
>> On Wed, 08 Feb 2012 07:02:12 -0500, Stephen Leake wrote:
>>> Patrick <patr...@spellingbeewinnars.org> writes:

>>
>>>> Would this same approach seem logical for ada? -Patrick

>>
>>> Yes; "Anything C can do, Ada can do Better"

>>
>>> Lua should be used for user scripting, not large-scale programming.

>>
>> There is no scripting which should not be done in Ada. Even if it does not
>> appear so at first glance, it is.

>
> HM -- That reminds me, I should re-try implementing a LISP interpreter
> in Ada.


No, the point is not to re-implement LISP, bash, perl, you name it, in Ada.
The point is to throw it away. The advantage of using Ada is Ada itself.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Reply With Quote
  #15 (permalink)  
Old 02-09-2012, 08:55 AM
Yannick Duchêne (Hibou57)
Guest
 
Posts: n/a
Default Re: ada without ada libraries?

Le Thu, 09 Feb 2012 09:34:45 +0100, Dmitry A. Kazakov
<mailbox@dmitry-kazakov.de> a écrit:
> No, the point is not to re-implement LISP, bash, perl, you name it, in
> Ada.
> The point is to throw it away. The advantage of using Ada is Ada itself.


Such an assertion seems silly to me (with apologize). No language at all,
not even Ada, could be an universal model for everything. There are place
for numerous DSL (read Domain Specific Language), and some scripting
languages, like LISP or derivatives, or logic programming languages, area
kind of.

However, as Ada is good at procedural stuff, type and interface safety and
implementation, this make sense to implement DSL interpreters with Ada (a
compiler or interpreter for a language X, need not be implemented with X
itself).

Or else, can you reasonably demonstrate your assertion ?

--
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 04:55 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.