comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: strange length check error
Date: Thu, 18 Jan 2018 01:00:45 +0200
Date: 2018-01-18T01:00:45+02:00	[thread overview]
Message-ID: <fca2stFg2sdU1@mid.individual.net> (raw)
In-Reply-To: <bbc4674b-75c0-402a-9487-1d34ce7c80e9@googlegroups.com>

On 18-01-17 21:43 , Simon Wright wrote:
 > Not sure what the problem is, but this looks like a case where you
 > should *not* 'use Ada.Text_IO;', especially in the spec.

On 18-01-17 23:37 , Mehdi Saada wrote:
> Ah ? Ah how am I gonna use File_Type then ? I can't do otherwise.

By qualifying with the name of the package in which it is defined:

    function Get_Line (
       File : Ada.Text_IO.File_Type := Ada.Text_IO.Standard_Input )
    return Bounded_String;

> If there is a way to do IO without Ada.Text_IO, I'm open.

As I understood Simon (but perhaps I should have let him answer), the 
point was to say only

    with Ada.Text_IO;

but *not* add

    use Ada.Text_IO;

because you are defining operations (Get_Line, Put_Line, ...) with the 
same names as operations in Ada.Text_IO, and you could get into problems 
with one definition hiding another.

The question "to 'use', or not to 'use'" is a big discussion in 
Ada-land, with people having different styles and preferences.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .

  reply	other threads:[~2018-01-17 23:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 20:48 strange length check error Mehdi Saada
2018-01-17  1:42 ` Anh Vo
2018-01-17  9:23   ` Simon Wright
2018-01-17 12:13     ` Mehdi Saada
2018-01-17 13:19       ` AdaMagica
2018-01-17 13:41         ` Simon Wright
2018-01-17 21:37           ` Jeffrey R. Carter
2018-01-18 11:12             ` Simon Wright
2018-01-17 13:43         ` Mehdi Saada
2018-01-17 14:03           ` Mehdi Saada
2018-01-17 16:15             ` Mehdi Saada
2018-01-17 19:43               ` Simon Wright
2018-01-17 21:37                 ` Mehdi Saada
2018-01-17 23:00                   ` Niklas Holsti [this message]
2018-01-18 11:07                     ` Simon Wright
2018-01-17 13:15     ` Simon Clubley
2018-01-17  8:49 ` Dmitry A. Kazakov
2018-01-23 16:18 ` Robert Eachus
2018-01-23 16:41   ` Mehdi Saada
2018-01-24 16:22     ` Robert Eachus
replies disabled

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