comp.lang.ada
 help / color / mirror / Atom feed
* Enjoying the new syntax of Ada 2012
@ 2011-10-14 13:02 Georg Bauhaus
  2011-10-14 13:05 ` Georg Bauhaus
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Georg Bauhaus @ 2011-10-14 13:02 UTC (permalink / raw)


Having thought much about identifiers recently,
I needed to condense something into some source code.
Ada is aids a lot in obfuscating. :-)
Will SPARK have me do it better, syntax-wise?

procedure Coffee is

   subtype L is Boolean;
   subtype I is Integer;
   subtype C is Character;

   function O (o : I) return I is
      (case 16 is when 16:C0FFEE: ! 2:1: => 0, when others => o);

   function O (P : L := 0 = I(0.0 - 0.0)) return L is
      (if 0 in 16:16: ! 2:1:-(-1) then O else O(0)=0);

   function "-" (L, R: C) return C is (C'Val(C'Pos(L)-C'Pos(R)));

   procedure Say (M : C) is separate;

   Y : C := '*';
   Z : C := 'T';
begin
   loop exit when Y > '*';
   declare
      T: constant L :=
	(case O is when 0 <=0=> 0**2:0:>0, when 1<=0=> 2**0>=1);
      function O (O : C) return C
      is
	 (if T /= (O>'*') then '_'-'^' else '-'-'-');
      begin
	 Y := Y - O(Y);
	 Z := Z - O(Y);
         exit when Y = '0'-'0';
      end;
   end loop;
   Say(Z);
end Coffee;

with Ada.Text_IO;
separate (Coffee) procedure Say (M : C) is
begin
   Ada.Text_IO.Put (I'Image(C'Pos(M)));
end Say;



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Enjoying the new syntax of Ada 2012
  2011-10-14 13:02 Enjoying the new syntax of Ada 2012 Georg Bauhaus
@ 2011-10-14 13:05 ` Georg Bauhaus
  2011-10-14 22:14   ` Jerry
  2011-10-14 13:18 ` okellogg
  2011-10-17  8:53 ` Egil Høvik
  2 siblings, 1 reply; 6+ messages in thread
From: Georg Bauhaus @ 2011-10-14 13:05 UTC (permalink / raw)


On 14.10.11 15:02, Georg Bauhaus wrote:

> Ada is aids a lot in obfuscating. :-)
This sounds like I need a week off ...



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Enjoying the new syntax of Ada 2012
  2011-10-14 13:02 Enjoying the new syntax of Ada 2012 Georg Bauhaus
  2011-10-14 13:05 ` Georg Bauhaus
@ 2011-10-14 13:18 ` okellogg
  2011-10-15 13:15   ` Peter C. Chapin
  2011-10-17  8:53 ` Egil Høvik
  2 siblings, 1 reply; 6+ messages in thread
From: okellogg @ 2011-10-14 13:18 UTC (permalink / raw)


On 14 Okt., 15:02, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
wrote:
> Having thought much about identifiers recently,
> I needed to condense something into some source code.
> Ada is aids a lot in obfuscating. :-)
> [...]

Ouch.
You take away some of my happiness about Ada being comparatively
easier to read ;)

As a sidenote, just for the identifiers (not the operators) see also
  http://okellogg.de/obfuscada.pl

-- Oliver



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Enjoying the new syntax of Ada 2012
  2011-10-14 13:05 ` Georg Bauhaus
@ 2011-10-14 22:14   ` Jerry
  0 siblings, 0 replies; 6+ messages in thread
From: Jerry @ 2011-10-14 22:14 UTC (permalink / raw)


On Oct 14, 6:05 am, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
wrote:
> On 14.10.11 15:02, Georg Bauhaus wrote:
>
> > Ada is aids a lot in obfuscating. :-)
>
> This sounds like I need a week off ...

Maybe you should have taken a week off before writing Coffee. ;-)
Jerry



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Enjoying the new syntax of Ada 2012
  2011-10-14 13:18 ` okellogg
@ 2011-10-15 13:15   ` Peter C. Chapin
  0 siblings, 0 replies; 6+ messages in thread
From: Peter C. Chapin @ 2011-10-15 13:15 UTC (permalink / raw)


On 2011-10-14 09:18, okellogg wrote:

> You take away some of my happiness about Ada being comparatively
> easier to read ;)

It isn't that strange looking if you are used to a functional language 
that makes an expression out of everything. One could argue that isn't 
the Ada way, however, but the syntax seems fine to me.

Peter



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Enjoying the new syntax of Ada 2012
  2011-10-14 13:02 Enjoying the new syntax of Ada 2012 Georg Bauhaus
  2011-10-14 13:05 ` Georg Bauhaus
  2011-10-14 13:18 ` okellogg
@ 2011-10-17  8:53 ` Egil Høvik
  2 siblings, 0 replies; 6+ messages in thread
From: Egil Høvik @ 2011-10-17  8:53 UTC (permalink / raw)


Looking at that code, I had a bit of a flashback...

https://groups.google.com/d/msg/comp.lang.ada/0vCvXkQLNn8/T04kaAUH6_EJ

:)


-- 
~egilhh



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-10-17  8:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-14 13:02 Enjoying the new syntax of Ada 2012 Georg Bauhaus
2011-10-14 13:05 ` Georg Bauhaus
2011-10-14 22:14   ` Jerry
2011-10-14 13:18 ` okellogg
2011-10-15 13:15   ` Peter C. Chapin
2011-10-17  8:53 ` Egil Høvik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox